diff --git a/pom.xml b/pom.xml
index f2c031794..7c33148a2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -243,6 +243,14 @@
${querydsl}
true
+
+
+
+ org.jmolecules.integrations
+ jmolecules-spring
+ ${jmolecules-integration}
+ test
+
diff --git a/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java b/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java
index f00b2910e..f6e2eab6b 100644
--- a/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java
+++ b/src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java
@@ -101,7 +101,8 @@ class JpaPersistentPropertyImpl extends AnnotationBasedPersistentProperty ASSOCIATION_ANNOTATIONS.stream().anyMatch(this::isAnnotationPresent));
+ this.isAssociation = Lazy.of(() -> super.isAssociation() //
+ || ASSOCIATION_ANNOTATIONS.stream().anyMatch(this::isAnnotationPresent));
this.usePropertyAccess = detectPropertyAccess();
this.associationTargetType = detectAssociationTargetType();
this.updateable = detectUpdatability();
@@ -117,7 +118,10 @@ class JpaPersistentPropertyImpl extends AnnotationBasedPersistentProperty getActualType() {
- return associationTargetType != null ? associationTargetType.getType() : super.getActualType();
+
+ return associationTargetType != null //
+ ? associationTargetType.getType() //
+ : super.getActualType();
}
/*
@@ -213,6 +217,18 @@ class JpaPersistentPropertyImpl extends AnnotationBasedPersistentProperty getAssociationTargetType() {
+
+ return associationTargetType != null //
+ ? associationTargetType.getType() //
+ : super.getAssociationTargetType();
+ }
+
/**
* Looks up both Spring Data's and JPA's access type definition annotations on the property or type level to determine
* the access type to be used. Will consider property-level annotations over type-level ones, favoring the Spring Data
diff --git a/src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java b/src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java
index b69b00f00..511136ec4 100644
--- a/src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java
+++ b/src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java
@@ -170,6 +170,16 @@ public class JpaPersistentPropertyImplUnitTests {
assertThat(property.isAssociation()).isFalse();
}
+ @Test
+ void detectsJMoleculesAssociation() {
+
+ JpaPersistentEntityImpl> entity = context.getRequiredPersistentEntity(JMoleculesSample.class);
+ JpaPersistentProperty property = entity.getRequiredPersistentProperty("association");
+
+ assertThat(property.isAssociation()).isTrue();
+ assertThat(property.getAssociationTargetType()).isEqualTo(JMoleculesAggregate.class);
+ }
+
private JpaPersistentProperty getProperty(Class> ownerType, String propertyName) {
JpaPersistentEntity> entity = context.getRequiredPersistentEntity(ownerType);
@@ -293,4 +303,12 @@ public class JpaPersistentPropertyImplUnitTests {
@Column(updatable = false) String name;
String updatable;
}
+
+ // jMolecules
+
+ private static class JMoleculesSample {
+ Association association;
+ }
+
+ private static interface JMoleculesAggregate extends AggregateRoot {}
}