Skip to content

Commit 6abe1ad

Browse files
authored
Merge pull request #5347 from geoand/#5317
Ensure that the name of the generated Spring data repositories is unique
2 parents c815b98 + e476a74 commit 6abe1ad

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/SpringDataRepositoryCreator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.jboss.jandex.IndexView;
2020
import org.jboss.jandex.Type;
2121

22+
import io.quarkus.deployment.util.HashUtil;
2223
import io.quarkus.deployment.util.JandexUtil;
2324
import io.quarkus.gizmo.ClassCreator;
2425
import io.quarkus.gizmo.ClassOutput;
@@ -73,10 +74,11 @@ public void implementCrudRepository(ClassInfo repositoryToImplement) {
7374
}
7475

7576
Map<String, FieldDescriptor> fragmentImplNameToFieldDescriptor = new HashMap<>();
76-
String generatedClassName = repositoryToImplement.name().toString() + "Impl";
77+
String repositoryToImplementStr = repositoryToImplement.name().toString();
78+
String generatedClassName = repositoryToImplementStr + "_" + HashUtil.sha1(repositoryToImplementStr) + "Impl";
7779
try (ClassCreator classCreator = ClassCreator.builder().classOutput(classOutput)
7880
.className(generatedClassName)
79-
.interfaces(repositoryToImplement.name().toString())
81+
.interfaces(repositoryToImplementStr)
8082
.build()) {
8183
classCreator.addAnnotation(ApplicationScoped.class);
8284

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import javax.persistence.EntityManager;
66
import javax.persistence.PersistenceContext;
77

8-
public class PersonFragmentImpl implements PersonFragment, PersonFragment2 {
8+
public class PersonRepositoryImpl implements PersonFragment, PersonFragment2 {
99

1010
@PersistenceContext
1111
EntityManager entityManager;

0 commit comments

Comments
 (0)