@@ -178,13 +178,13 @@ private static Element dereference(AccessType defaultAccessType, Element symbol,
178
178
}
179
179
}
180
180
181
- static Type propertyType (Element member , String entityName , String path , AccessType defaultAccessType ) {
181
+ private Type propertyType (Element member , String entityName , String path , AccessType defaultAccessType ) {
182
182
final TypeMirror memberType = memberType (member );
183
183
if (isEmbeddedProperty (member )) {
184
- return component .make (asElement (memberType ), entityName , path , defaultAccessType );
184
+ return component .make (asElement (memberType ), entityName , path , defaultAccessType , this );
185
185
}
186
186
else if (isToOneAssociation (member )) {
187
- return new ManyToOneType (typeConfiguration , getToOneTargetEntity (member ));
187
+ return new ManyToOneType (getTypeConfiguration () , getToOneTargetEntity (member ));
188
188
}
189
189
else if (isToManyAssociation (member )) {
190
190
return collectionType (memberType , qualify (entityName , path ));
@@ -193,10 +193,10 @@ else if (isElementCollectionProperty(member)) {
193
193
return collectionType (memberType , qualify (entityName , path ));
194
194
}
195
195
else if (isEnumProperty (member )) {
196
- return enumType ( member , memberType );
196
+ return enumType (member , memberType );
197
197
}
198
198
else {
199
- return typeConfiguration .getBasicTypeRegistry ()
199
+ return getTypeConfiguration () .getBasicTypeRegistry ()
200
200
.getRegisteredType (qualifiedName (memberType ));
201
201
}
202
202
}
@@ -255,12 +255,13 @@ Set<String> getEnumTypesForValue(String value) {
255
255
256
256
private static Type elementCollectionElementType (TypeElement elementType ,
257
257
String role , String path ,
258
- AccessType defaultAccessType ) {
258
+ AccessType defaultAccessType ,
259
+ MockSessionFactory factory ) {
259
260
if (isEmbeddableType (elementType )) {
260
- return component .make (elementType , role , path , defaultAccessType );
261
+ return component .make (elementType , role , path , defaultAccessType , factory );
261
262
}
262
263
else {
263
- return typeConfiguration .getBasicTypeRegistry ()
264
+ return factory . getTypeConfiguration () .getBasicTypeRegistry ()
264
265
.getRegisteredType (qualifiedName (elementType .asType ()));
265
266
}
266
267
}
@@ -277,7 +278,8 @@ public static abstract class Component implements CompositeType {
277
278
278
279
public Component (TypeElement type ,
279
280
String entityName , String path ,
280
- AccessType defaultAccessType ) {
281
+ AccessType defaultAccessType ,
282
+ ProcessorSessionFactory factory ) {
281
283
this .type = type ;
282
284
283
285
List <String > names = new ArrayList <>();
@@ -290,7 +292,7 @@ public Component(TypeElement type,
290
292
if (isPersistable (member , accessType )) {
291
293
String name = propertyName (member );
292
294
Type propertyType =
293
- propertyType (member , entityName ,
295
+ factory . propertyType (member , entityName ,
294
296
qualify (path , name ), defaultAccessType );
295
297
if (propertyType != null ) {
296
298
names .add (name );
@@ -358,11 +360,13 @@ public int getColumnSpan(MappingContext mapping) {
358
360
public static abstract class EntityPersister extends MockEntityPersister {
359
361
private final TypeElement type ;
360
362
private final Types typeUtil ;
363
+ private final ProcessorSessionFactory factory ;
361
364
362
- public EntityPersister (String entityName , TypeElement type , ProcessorSessionFactory that ) {
363
- super (entityName , getDefaultAccessType (type ), that );
365
+ public EntityPersister (String entityName , TypeElement type , ProcessorSessionFactory factory ) {
366
+ super (entityName , getDefaultAccessType (type ), factory );
364
367
this .type = type ;
365
- this .typeUtil = that .typeUtil ;
368
+ this .typeUtil = factory .typeUtil ;
369
+ this .factory = factory ;
366
370
initSubclassPersisters ();
367
371
}
368
372
@@ -397,7 +401,7 @@ boolean isSubclassPersister(MockEntityPersister entityPersister) {
397
401
Type createPropertyType (String propertyPath ) {
398
402
Element symbol = findPropertyByPath (type , propertyPath , defaultAccessType );
399
403
return symbol == null ? null :
400
- propertyType (symbol , getEntityName (), propertyPath , defaultAccessType );
404
+ factory . propertyType (symbol , getEntityName (), propertyPath , defaultAccessType );
401
405
}
402
406
403
407
@ Override
@@ -414,7 +418,7 @@ public String identifierPropertyName() {
414
418
public Type identifierType () {
415
419
for (Element element : type .getEnclosedElements ()) {
416
420
if ( hasAnnotation (element , "Id" )|| hasAnnotation (element , "EmbeddedId" ) ) {
417
- return propertyType (element , getEntityName (), EntityIdentifierMapping .ID_ROLE_NAME , defaultAccessType );
421
+ return factory . propertyType (element , getEntityName (), EntityIdentifierMapping .ID_ROLE_NAME , defaultAccessType );
418
422
}
419
423
}
420
424
return null ;
@@ -424,7 +428,7 @@ public Type identifierType() {
424
428
public BasicType <?> versionType () {
425
429
for (Element element : type .getEnclosedElements ()) {
426
430
if ( hasAnnotation (element , "Version" ) ) {
427
- return (BasicType <?>) propertyType (element , getEntityName (), "{version}" , defaultAccessType );
431
+ return (BasicType <?>) factory . propertyType (element , getEntityName (), "{version}" , defaultAccessType );
428
432
}
429
433
}
430
434
return null ;
@@ -434,7 +438,7 @@ public BasicType<?> versionType() {
434
438
public abstract static class ToManyAssociationPersister extends MockCollectionPersister {
435
439
public ToManyAssociationPersister (String role , CollectionType collectionType , String targetEntityName , ProcessorSessionFactory that ) {
436
440
super (role , collectionType ,
437
- new ManyToOneType (typeConfiguration , targetEntityName ),
441
+ new ManyToOneType (that . getTypeConfiguration () , targetEntityName ),
438
442
that );
439
443
}
440
444
@@ -447,26 +451,29 @@ Type getElementPropertyType(String propertyPath) {
447
451
public abstract static class ElementCollectionPersister extends MockCollectionPersister {
448
452
private final TypeElement elementType ;
449
453
private final AccessType defaultAccessType ;
454
+ private final ProcessorSessionFactory factory ;
450
455
451
456
public ElementCollectionPersister (String role ,
452
457
CollectionType collectionType ,
453
458
TypeElement elementType ,
454
459
String propertyPath ,
455
460
AccessType defaultAccessType ,
456
- ProcessorSessionFactory that ) {
461
+ ProcessorSessionFactory factory ) {
457
462
super (role , collectionType ,
458
463
elementCollectionElementType (elementType , role ,
459
- propertyPath , defaultAccessType ),
460
- that );
464
+ propertyPath , defaultAccessType ,
465
+ factory ),
466
+ factory );
461
467
this .elementType = elementType ;
462
468
this .defaultAccessType = defaultAccessType ;
469
+ this .factory = factory ;
463
470
}
464
471
465
472
@ Override
466
473
Type getElementPropertyType (String propertyPath ) {
467
474
Element symbol = findPropertyByPath (elementType , propertyPath , defaultAccessType );
468
475
return symbol == null ? null :
469
- propertyType (symbol , getOwnerEntityName (), propertyPath , defaultAccessType );
476
+ factory . propertyType (symbol , getOwnerEntityName (), propertyPath , defaultAccessType );
470
477
}
471
478
}
472
479
0 commit comments