250
250
import org .hibernate .sql .ast .tree .from .TableGroup ;
251
251
import org .hibernate .sql .ast .tree .from .TableReference ;
252
252
import org .hibernate .sql .ast .tree .from .TableReferenceJoin ;
253
- import org .hibernate .sql .ast .tree .insert .InsertSelectStatement ;
254
253
import org .hibernate .sql .ast .tree .predicate .ComparisonPredicate ;
255
254
import org .hibernate .sql .ast .tree .predicate .InListPredicate ;
256
255
import org .hibernate .sql .ast .tree .predicate .Junction ;
@@ -511,7 +510,7 @@ public AbstractEntityPersister(
511
510
assert javaType != null ;
512
511
this .implementsLifecycle = Lifecycle .class .isAssignableFrom ( javaType .getJavaTypeClass () );
513
512
514
- concreteProxy = isPolymorphic ()
513
+ concreteProxy = entityMetamodel . isPolymorphic ()
515
514
&& ( getBytecodeEnhancementMetadata ().isEnhancedForLazyLoading () || hasProxy () )
516
515
&& persistentClass .isConcreteProxy ();
517
516
@@ -924,8 +923,6 @@ private boolean shouldStoreDiscriminatorInShallowQueryCacheLayout(CacheLayout en
924
923
return queryCacheLayout == CacheLayout .SHALLOW_WITH_DISCRIMINATOR ;
925
924
}
926
925
927
- public abstract String getSubclassTableName (int j );
928
-
929
926
protected abstract String [] getSubclassTableNames ();
930
927
931
928
protected abstract String [] getSubclassTableKeyColumns (int j );
@@ -948,37 +945,12 @@ protected boolean isClassOrSuperclassJoin(int j) {
948
945
return isClassOrSuperclassTable ( j );
949
946
}
950
947
951
- public abstract int getSubclassTableSpan ();
952
-
953
- public abstract int getTableSpan ();
954
-
955
- public abstract boolean hasDuplicateTables ();
956
-
957
- /**
958
- * @deprecated Only ever used from places where we really want to use<ul>
959
- * <li>{@link SelectStatement} (select generator)</li>
960
- * <li>{@link InsertSelectStatement}</li>
961
- * <li>{@link org.hibernate.sql.ast.tree.update.UpdateStatement}</li>
962
- * <li>{@link org.hibernate.sql.ast.tree.delete.DeleteStatement}</li>
963
- * </ul>
964
- */
965
- @ Deprecated ( since = "6.2" )
966
- public abstract String getTableName (int j );
967
-
968
- public abstract String [] getKeyColumns (int j );
969
-
970
948
public abstract boolean isPropertyOfTable (int property , int j );
971
949
972
950
protected abstract int [] getPropertyTableNumbers ();
973
951
974
952
private static final String DISCRIMINATOR_ALIAS = "clazz_" ;
975
953
976
- /**
977
- * The name of the table to use when performing mutations (INSERT,UPDATE,DELETE)
978
- * for the given attribute
979
- */
980
- public abstract String getAttributeMutationTableName (int i );
981
-
982
954
@ Override
983
955
public String getDiscriminatorColumnName () {
984
956
return DISCRIMINATOR_ALIAS ;
@@ -998,10 +970,12 @@ public String getDiscriminatorFormulaTemplate() {
998
970
return null ;
999
971
}
1000
972
973
+ @ Override
1001
974
public boolean isInverseTable (int j ) {
1002
975
return false ;
1003
976
}
1004
977
978
+ @ Override
1005
979
public boolean isNullableTable (int j ) {
1006
980
return false ;
1007
981
}
@@ -1015,6 +989,7 @@ public boolean isSubclassEntityName(String entityName) {
1015
989
return entityMetamodel .getSubclassEntityNames ().contains ( entityName );
1016
990
}
1017
991
992
+ @ Override
1018
993
public boolean isSharedColumn (String columnExpression ) {
1019
994
return sharedColumnNames .contains ( columnExpression );
1020
995
}
@@ -1069,6 +1044,7 @@ public boolean hasRowId() {
1069
1044
return rowIdName != null ;
1070
1045
}
1071
1046
1047
+ @ Override
1072
1048
public String [] getTableNames () {
1073
1049
final String [] tableNames = new String [getTableSpan ()];
1074
1050
for ( int i = 0 ; i < tableNames .length ; i ++ ) {
@@ -1373,7 +1349,7 @@ protected TableReferenceJoin generateTableReferenceJoin(
1373
1349
generateJoinPredicate (
1374
1350
lhs ,
1375
1351
joinedTableReference ,
1376
- getKeyColumnNames (),
1352
+ getIdentifierColumnNames (),
1377
1353
targetColumns ,
1378
1354
creationState
1379
1355
)
@@ -1524,7 +1500,7 @@ public Object initializeLazyProperty(String fieldName, Object entity, SharedSess
1524
1500
1525
1501
}
1526
1502
1527
- public Object getCollectionKey (
1503
+ public static Object getCollectionKey (
1528
1504
CollectionPersister persister ,
1529
1505
Object owner ,
1530
1506
EntityEntry ownerEntry ,
@@ -2244,20 +2220,20 @@ public boolean hasFormulaProperties() {
2244
2220
return hasFormulaProperties ;
2245
2221
}
2246
2222
2247
- @ Override
2248
2223
public FetchMode getFetchMode (int i ) {
2249
2224
return subclassPropertyFetchModeClosure [i ];
2250
2225
}
2251
2226
2252
- @ Override
2253
2227
public Type getSubclassPropertyType (int i ) {
2254
2228
return subclassPropertyTypeClosure [i ];
2255
2229
}
2256
2230
2231
+ @ Override
2257
2232
public int countSubclassProperties () {
2258
2233
return subclassPropertyTypeClosure .length ;
2259
2234
}
2260
2235
2236
+ @ Override
2261
2237
public String [] getSubclassPropertyColumnNames (int i ) {
2262
2238
return subclassPropertyColumnNameClosure [i ];
2263
2239
}
@@ -2607,17 +2583,6 @@ public String getSelectByUniqueKeyString(String[] propertyNames, String[] column
2607
2583
return select .toStatementString ();
2608
2584
}
2609
2585
2610
- @ Internal
2611
- public boolean hasLazyDirtyFields (int [] dirtyFields ) {
2612
- final boolean [] propertyLaziness = getPropertyLaziness ();
2613
- for ( int i = 0 ; i < dirtyFields .length ; i ++ ) {
2614
- if ( propertyLaziness [dirtyFields [i ]] ) {
2615
- return true ;
2616
- }
2617
- }
2618
- return false ;
2619
- }
2620
-
2621
2586
@ Override
2622
2587
public GeneratedValuesMutationDelegate getInsertDelegate () {
2623
2588
return insertDelegate ;
@@ -2628,34 +2593,25 @@ public GeneratedValuesMutationDelegate getUpdateDelegate() {
2628
2593
return updateDelegate ;
2629
2594
}
2630
2595
2631
- protected EntityTableMapping [] getTableMappings () {
2596
+ @ Override
2597
+ public EntityTableMapping [] getTableMappings () {
2632
2598
return tableMappings ;
2633
2599
}
2634
2600
2635
- public EntityTableMapping getTableMapping (int i ) {
2601
+ protected EntityTableMapping getTableMapping (int i ) {
2636
2602
return tableMappings [i ];
2637
2603
}
2638
2604
2639
2605
/**
2640
2606
* Unfortunately we cannot directly use `SelectableMapping#getContainingTableExpression()`
2641
2607
* as that blows up for attributes declared on super-type for union-subclass mappings
2642
2608
*/
2609
+ @ Override
2643
2610
public String physicalTableNameForMutation (SelectableMapping selectableMapping ) {
2644
2611
assert !selectableMapping .isFormula ();
2645
2612
return selectableMapping .getContainingTableExpression ();
2646
2613
}
2647
2614
2648
- public EntityTableMapping getPhysicalTableMappingForMutation (SelectableMapping selectableMapping ) {
2649
- final String tableNameForMutation = physicalTableNameForMutation ( selectableMapping );
2650
- for ( int i = 0 ; i < tableMappings .length ; i ++ ) {
2651
- if ( tableNameForMutation .equals ( tableMappings [i ].getTableName () ) ) {
2652
- return tableMappings [i ];
2653
- }
2654
- }
2655
-
2656
- throw new IllegalArgumentException ( "Unable to resolve TableMapping for selectable - " + selectableMapping );
2657
- }
2658
-
2659
2615
@ Override
2660
2616
public EntityMappingType getTargetPart () {
2661
2617
return this ;
@@ -2823,7 +2779,7 @@ public TableGroup createRootTableGroup(
2823
2779
joinedTableReference ,
2824
2780
needsDiscriminator ()
2825
2781
? getRootTableKeyColumnNames ()
2826
- : getKeyColumnNames (),
2782
+ : getIdentifierColumnNames (),
2827
2783
getSubclassTableKeyColumns ( i ),
2828
2784
creationState
2829
2785
)
@@ -3200,8 +3156,6 @@ protected GeneratedValuesMutationDelegate createUpdateDelegate() {
3200
3156
return GeneratedValuesHelper .getGeneratedValuesDelegate ( this , UPDATE );
3201
3157
}
3202
3158
3203
- public abstract String [][] getContraintOrderedTableKeyColumnClosure ();
3204
-
3205
3159
private static class TableMappingBuilder {
3206
3160
private final String tableName ;
3207
3161
private final int relativePosition ;
@@ -3436,9 +3390,11 @@ protected DeleteCoordinator buildDeleteCoordinator() {
3436
3390
}
3437
3391
}
3438
3392
3393
+ @ Override
3439
3394
public void addDiscriminatorToInsertGroup (MutationGroupBuilder insertGroupBuilder ) {
3440
3395
}
3441
3396
3397
+ @ Override
3442
3398
public void addSoftDeleteToInsertGroup (MutationGroupBuilder insertGroupBuilder ) {
3443
3399
if ( softDeleteMapping != null ) {
3444
3400
final TableInsertBuilder insertBuilder = insertGroupBuilder .getTableDetailsBuilder ( getIdentifierTableName () );
@@ -3755,10 +3711,6 @@ public final String getEntityName() {
3755
3711
return entityMetamodel .getName ();
3756
3712
}
3757
3713
3758
- public boolean isPolymorphic () {
3759
- return entityMetamodel .isPolymorphic ();
3760
- }
3761
-
3762
3714
@ Override
3763
3715
public boolean isInherited () {
3764
3716
return entityMetamodel .isInherited ();
@@ -3997,10 +3949,6 @@ public EntityMappingType resolveConcreteProxyTypeForId(Object id, SharedSessionC
3997
3949
return concreteTypeLoader .getConcreteType ( id , session );
3998
3950
}
3999
3951
4000
- public String [] getKeyColumnNames () {
4001
- return getIdentifierColumnNames ();
4002
- }
4003
-
4004
3952
/**
4005
3953
* {@inheritDoc}
4006
3954
*
@@ -4119,6 +4067,7 @@ public boolean[] getPropertyCheckability() {
4119
4067
return entityMetamodel .getPropertyCheckability ();
4120
4068
}
4121
4069
4070
+ @ Override
4122
4071
public boolean [] getNonLazyPropertyUpdateability () {
4123
4072
return entityMetamodel .getNonlazyPropertyUpdateability ();
4124
4073
}
@@ -4366,6 +4315,7 @@ && hasSubclasses()
4366
4315
return this ;
4367
4316
}
4368
4317
4318
+ @ Override
4369
4319
public boolean hasMultipleTables () {
4370
4320
return false ;
4371
4321
}
@@ -4589,7 +4539,12 @@ public BytecodeEnhancementMetadata getBytecodeEnhancementMetadata() {
4589
4539
return entityMetamodel .getBytecodeEnhancementMetadata ();
4590
4540
}
4591
4541
4592
- public int determineTableNumberForColumn (String columnName ) {
4542
+ @ Override
4543
+ public String getTableNameForColumn (String columnName ) {
4544
+ return getTableName ( determineTableNumberForColumn ( columnName ) );
4545
+ }
4546
+
4547
+ protected int determineTableNumberForColumn (String columnName ) {
4593
4548
return 0 ;
4594
4549
}
4595
4550
0 commit comments