Skip to content

Commit

Permalink
Merge pull request #5347 from geoand/#5317
Browse files Browse the repository at this point in the history
Ensure that the name of the generated Spring data repositories is unique
  • Loading branch information
geoand authored Nov 9, 2019
2 parents c815b98 + e476a74 commit 6abe1ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.jboss.jandex.IndexView;
import org.jboss.jandex.Type;

import io.quarkus.deployment.util.HashUtil;
import io.quarkus.deployment.util.JandexUtil;
import io.quarkus.gizmo.ClassCreator;
import io.quarkus.gizmo.ClassOutput;
Expand Down Expand Up @@ -73,10 +74,11 @@ public void implementCrudRepository(ClassInfo repositoryToImplement) {
}

Map<String, FieldDescriptor> fragmentImplNameToFieldDescriptor = new HashMap<>();
String generatedClassName = repositoryToImplement.name().toString() + "Impl";
String repositoryToImplementStr = repositoryToImplement.name().toString();
String generatedClassName = repositoryToImplementStr + "_" + HashUtil.sha1(repositoryToImplementStr) + "Impl";
try (ClassCreator classCreator = ClassCreator.builder().classOutput(classOutput)
.className(generatedClassName)
.interfaces(repositoryToImplement.name().toString())
.interfaces(repositoryToImplementStr)
.build()) {
classCreator.addAnnotation(ApplicationScoped.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

public class PersonFragmentImpl implements PersonFragment, PersonFragment2 {
public class PersonRepositoryImpl implements PersonFragment, PersonFragment2 {

@PersistenceContext
EntityManager entityManager;
Expand Down

0 comments on commit 6abe1ad

Please sign in to comment.