File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
hibernate-core/src/main/java/org/hibernate/boot/model/internal Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -452,9 +452,16 @@ else if ( columnOwner instanceof Join ) {
452
452
// which are mapped to that column. (There might be multiple such
453
453
// properties for each column.)
454
454
if ( columnOwner instanceof PersistentClass ) {
455
- PersistentClass persistentClass = (PersistentClass ) columnOwner ;
455
+ final PersistentClass persistentClass = (PersistentClass ) columnOwner ;
456
+ // Process ToOne associations after Components, Basic and Id properties
457
+ final List <Property > toOneProperties = new ArrayList <>();
456
458
for ( Property property : persistentClass .getReferenceableProperties () ) {
457
- matchColumnsByProperty ( property , columnsToProperty );
459
+ if ( property .getValue () instanceof ToOne ) {
460
+ toOneProperties .add ( property );
461
+ }
462
+ else {
463
+ matchColumnsByProperty ( property , columnsToProperty );
464
+ }
458
465
}
459
466
if ( persistentClass .hasIdentifierProperty () ) {
460
467
matchColumnsByProperty ( persistentClass .getIdentifierProperty (), columnsToProperty );
@@ -466,6 +473,9 @@ else if ( columnOwner instanceof Join ) {
466
473
matchColumnsByProperty ( p , columnsToProperty );
467
474
}
468
475
}
476
+ for ( Property property : toOneProperties ) {
477
+ matchColumnsByProperty ( property , columnsToProperty );
478
+ }
469
479
}
470
480
else {
471
481
for ( Property property : ((Join ) columnOwner ).getProperties () ) {
You can’t perform that action at this time.
0 commit comments