File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
core/src/test/java/com/cosium/spring/data/jpa/entity/graph/repository
generator/src/main/java/com/cosium/spring/data/jpa/graph/generator Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 8
8
import com .github .springtestdbunit .annotation .DatabaseSetup ;
9
9
import javax .inject .Inject ;
10
10
import org .hibernate .Hibernate ;
11
+ import org .junit .jupiter .api .DisplayName ;
11
12
import org .junit .jupiter .api .Test ;
12
13
import org .springframework .transaction .annotation .Transactional ;
13
14
@@ -43,5 +44,12 @@ void test() {
43
44
assertThat (Hibernate .isInitialized (product .getMaker ().getCountry ())).isTrue ();
44
45
}
45
46
47
+ @ Test
48
+ @ DisplayName ("EntityGraph with embedded part is well generated" )
49
+ @ Transactional
50
+ void test2 () {
51
+ ProductEntityGraph .____ ().tracking ().creator ().____ .tracking ().modifier ().____ .____ ();
52
+ }
53
+
46
54
public interface ProductRepository extends EntityGraphCrudRepository <Product , Long > {}
47
55
}
Original file line number Diff line number Diff line change @@ -75,14 +75,17 @@ public Optional<MetamodelAttributeTarget> jpaTarget() {
75
75
return Optional .empty ();
76
76
}
77
77
78
- if ((targetTypeElement .getAnnotation (Entity .class ) == null
79
- && targetTypeElement .getAnnotation (Embeddable .class ) == null )
80
- && !pluralAttribute ) {
78
+ if (!isRelatedToEntityConcept (targetTypeElement ) && !pluralAttribute ) {
81
79
return Optional .empty ();
82
80
}
83
81
84
82
return Optional .of (
85
83
new MetamodelAttributeTarget (
86
84
variableElement .getSimpleName ().toString (), targetTypeElement ));
87
85
}
86
+
87
+ private boolean isRelatedToEntityConcept (TypeElement targetTypeElement ) {
88
+ return targetTypeElement .getAnnotation (Entity .class ) != null
89
+ || targetTypeElement .getAnnotation (Embeddable .class ) != null ;
90
+ }
88
91
}
You can’t perform that action at this time.
0 commit comments