Skip to content

Commit 69ddb4f

Browse files
jwgmeligmeylingSanne
authored andcommitted
HHH-14223 - Consider formulaTemplates in ID mapping for formula dereference
1 parent 4c364a1 commit 69ddb4f

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

Diff for: hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractPropertyMapping.java

+16-4
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ else if ( type.isEntityType() ) {
361361
columns,
362362
columnReaders,
363363
columnReaderTemplates,
364+
formulaTemplates != null && formulaTemplates.length > 0 ? formulaTemplates : null,
364365
factory
365366
);
366367
}
@@ -373,6 +374,17 @@ protected void initIdentifierPropertyPaths(
373374
final String[] columnReaders,
374375
final String[] columnReaderTemplates,
375376
final Mapping factory) throws MappingException {
377+
initIdentifierPropertyPaths(path, etype, columns, columnReaders, columnReaderTemplates, null, factory);
378+
}
379+
380+
protected void initIdentifierPropertyPaths(
381+
final String path,
382+
final EntityType etype,
383+
final String[] columns,
384+
final String[] columnReaders,
385+
final String[] columnReaderTemplates,
386+
final String[] formulaTemplates,
387+
final Mapping factory) throws MappingException {
376388

377389
Type idtype = etype.getIdentifierOrUniqueKeyType( factory );
378390
String idPropName = etype.getIdentifierOrUniqueKeyPropertyName( factory );
@@ -381,15 +393,15 @@ protected void initIdentifierPropertyPaths(
381393
if ( etype.isReferenceToPrimaryKey() ) {
382394
if ( !hasNonIdentifierPropertyNamedId ) {
383395
String idpath1 = extendPath( path, EntityPersister.ENTITY_ID );
384-
addPropertyPath( idpath1, idtype, columns, columnReaders, columnReaderTemplates, null, factory );
385-
initPropertyPaths( idpath1, idtype, columns, columnReaders, columnReaderTemplates, null, factory );
396+
addPropertyPath( idpath1, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
397+
initPropertyPaths( idpath1, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
386398
}
387399
}
388400

389401
if ( (! etype.isNullable() ) && idPropName != null ) {
390402
String idpath2 = extendPath( path, idPropName );
391-
addPropertyPath( idpath2, idtype, columns, columnReaders, columnReaderTemplates, null, factory );
392-
initPropertyPaths( idpath2, idtype, columns, columnReaders, columnReaderTemplates, null, factory );
403+
addPropertyPath( idpath2, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
404+
initPropertyPaths( idpath2, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
393405
}
394406
}
395407

0 commit comments

Comments
 (0)