@@ -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(Mapping 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
@@ -376,15 +380,15 @@ boolean isSubclassPersister(MockEntityPersister entityPersister) {
376
380
Type createPropertyType (String propertyPath ) {
377
381
Element symbol = findPropertyByPath (type , propertyPath , defaultAccessType );
378
382
return symbol == null ? null :
379
- propertyType (symbol , getEntityName (), propertyPath , defaultAccessType );
383
+ factory . propertyType (symbol , getEntityName (), propertyPath , defaultAccessType );
380
384
}
381
385
382
386
}
383
387
384
388
public abstract static class ToManyAssociationPersister extends MockCollectionPersister {
385
389
public ToManyAssociationPersister (String role , CollectionType collectionType , String targetEntityName , ProcessorSessionFactory that ) {
386
390
super (role , collectionType ,
387
- new ManyToOneType (typeConfiguration , targetEntityName ),
391
+ new ManyToOneType (that . getTypeConfiguration () , targetEntityName ),
388
392
that );
389
393
}
390
394
@@ -397,26 +401,29 @@ Type getElementPropertyType(String propertyPath) {
397
401
public abstract static class ElementCollectionPersister extends MockCollectionPersister {
398
402
private final TypeElement elementType ;
399
403
private final AccessType defaultAccessType ;
404
+ private final ProcessorSessionFactory factory ;
400
405
401
406
public ElementCollectionPersister (String role ,
402
407
CollectionType collectionType ,
403
408
TypeElement elementType ,
404
409
String propertyPath ,
405
410
AccessType defaultAccessType ,
406
- ProcessorSessionFactory that ) {
411
+ ProcessorSessionFactory factory ) {
407
412
super (role , collectionType ,
408
413
elementCollectionElementType (elementType , role ,
409
- propertyPath , defaultAccessType ),
410
- that );
414
+ propertyPath , defaultAccessType ,
415
+ factory ),
416
+ factory );
411
417
this .elementType = elementType ;
412
418
this .defaultAccessType = defaultAccessType ;
419
+ this .factory = factory ;
413
420
}
414
421
415
422
@ Override
416
423
Type getElementPropertyType (String propertyPath ) {
417
424
Element symbol = findPropertyByPath (elementType , propertyPath , defaultAccessType );
418
425
return symbol == null ? null :
419
- propertyType (symbol , getOwnerEntityName (), propertyPath , defaultAccessType );
426
+ factory . propertyType (symbol , getOwnerEntityName (), propertyPath , defaultAccessType );
420
427
}
421
428
}
422
429
0 commit comments