1616import org .burningwave .core .classes .GenericSourceGenerator ;
1717import org .burningwave .core .classes .TypeDeclarationSourceGenerator ;
1818import org .burningwave .core .classes .UnitSourceGenerator ;
19+ import org .springframework .data .jpa .repository .JpaRepository ;
1920import org .springframework .stereotype .Repository ;
2021
2122import dev .sassine .api .structure .export .builder .factory .Factory ;
@@ -25,8 +26,6 @@ public class RepositoryFactory implements Factory {
2526
2627 private static final Logger log = getLogger ();
2728
28- private static final String PACKAGE_JPAREPOSITORY = "org.springframework.data.jpa.repository.JpaRepository" ;
29- private static final String CLASSNAME_JPAREPOSITORY = "JpaRepository" ;
3029 private static final String DOT_REPOSITORY = ".repository" ;
3130 private static final String ENTITY_REPOSITORY = "EntityRepository" ;
3231 private static final String ENTITY = "Entity" ;
@@ -39,16 +38,15 @@ public void execute(EntityModel entityModel, boolean isAutoGenerated, String nam
3938 ClassSourceGenerator interfaceClass = this .buildClassSource (entityModel , nameClass );
4039 log .debug ("InterfaceRepository builded" );
4140 importEntityClass (nameClass , packageName , gen );
42- gen .addImport (PACKAGE_JPAREPOSITORY );
4341 gen .addClass (interfaceClass );
4442 store (gen );
4543 log .debug ("Repository EntityClass ({}) stored" , nameClass );
4644 }
4745
4846 private ClassSourceGenerator buildClassSource (EntityModel entityModel , String nameClass ) {
4947 return ClassSourceGenerator
50- .createInterface (TypeDeclarationSourceGenerator .create (ENTITY_REPOSITORY ))
51- .expands (TypeDeclarationSourceGenerator .create (CLASSNAME_JPAREPOSITORY )
48+ .createInterface (TypeDeclarationSourceGenerator .create (nameClass . concat ( ENTITY_REPOSITORY ) ))
49+ .expands (TypeDeclarationSourceGenerator .create (JpaRepository . class )
5250 .addGeneric (GenericSourceGenerator .create (nameClass .concat (ENTITY )))
5351 .addGeneric (GenericSourceGenerator .create (this .getIdClassType (entityModel ))))
5452 .addModifier (PUBLIC )
0 commit comments