249
249
import org .hibernate .sql .ast .tree .from .TableGroup ;
250
250
import org .hibernate .sql .ast .tree .from .TableReference ;
251
251
import org .hibernate .sql .ast .tree .from .TableReferenceJoin ;
252
- import org .hibernate .sql .ast .tree .insert .InsertSelectStatement ;
253
252
import org .hibernate .sql .ast .tree .predicate .ComparisonPredicate ;
254
253
import org .hibernate .sql .ast .tree .predicate .InListPredicate ;
255
254
import org .hibernate .sql .ast .tree .predicate .Junction ;
@@ -520,7 +519,7 @@ public AbstractEntityPersister(
520
519
assert javaType != null ;
521
520
this .implementsLifecycle = Lifecycle .class .isAssignableFrom ( javaType .getJavaTypeClass () );
522
521
523
- concreteProxy = isPolymorphic ()
522
+ concreteProxy = entityMetamodel . isPolymorphic ()
524
523
&& ( getBytecodeEnhancementMetadata ().isEnhancedForLazyLoading () || hasProxy () )
525
524
&& persistentClass .isConcreteProxy ();
526
525
@@ -935,8 +934,6 @@ private boolean shouldStoreDiscriminatorInShallowQueryCacheLayout(CacheLayout en
935
934
return queryCacheLayout == CacheLayout .SHALLOW_WITH_DISCRIMINATOR ;
936
935
}
937
936
938
- public abstract String getSubclassTableName (int j );
939
-
940
937
protected abstract String [] getSubclassTableNames ();
941
938
942
939
protected abstract String [] getSubclassTableKeyColumns (int j );
@@ -959,37 +956,12 @@ protected boolean isClassOrSuperclassJoin(int j) {
959
956
return isClassOrSuperclassTable ( j );
960
957
}
961
958
962
- public abstract int getSubclassTableSpan ();
963
-
964
- public abstract int getTableSpan ();
965
-
966
- public abstract boolean hasDuplicateTables ();
967
-
968
- /**
969
- * @deprecated Only ever used from places where we really want to use<ul>
970
- * <li>{@link SelectStatement} (select generator)</li>
971
- * <li>{@link InsertSelectStatement}</li>
972
- * <li>{@link org.hibernate.sql.ast.tree.update.UpdateStatement}</li>
973
- * <li>{@link org.hibernate.sql.ast.tree.delete.DeleteStatement}</li>
974
- * </ul>
975
- */
976
- @ Deprecated ( since = "6.2" )
977
- public abstract String getTableName (int j );
978
-
979
- public abstract String [] getKeyColumns (int j );
980
-
981
959
public abstract boolean isPropertyOfTable (int property , int j );
982
960
983
961
protected abstract int [] getPropertyTableNumbers ();
984
962
985
963
private static final String DISCRIMINATOR_ALIAS = "clazz_" ;
986
964
987
- /**
988
- * The name of the table to use when performing mutations (INSERT,UPDATE,DELETE)
989
- * for the given attribute
990
- */
991
- public abstract String getAttributeMutationTableName (int i );
992
-
993
965
@ Override
994
966
public String getDiscriminatorColumnName () {
995
967
return DISCRIMINATOR_ALIAS ;
@@ -1009,10 +981,12 @@ public String getDiscriminatorFormulaTemplate() {
1009
981
return null ;
1010
982
}
1011
983
984
+ @ Override
1012
985
public boolean isInverseTable (int j ) {
1013
986
return false ;
1014
987
}
1015
988
989
+ @ Override
1016
990
public boolean isNullableTable (int j ) {
1017
991
return false ;
1018
992
}
@@ -1026,6 +1000,7 @@ public boolean isSubclassEntityName(String entityName) {
1026
1000
return entityMetamodel .getSubclassEntityNames ().contains ( entityName );
1027
1001
}
1028
1002
1003
+ @ Override
1029
1004
public boolean isSharedColumn (String columnExpression ) {
1030
1005
return sharedColumnNames .contains ( columnExpression );
1031
1006
}
@@ -1080,6 +1055,7 @@ public boolean hasRowId() {
1080
1055
return rowIdName != null ;
1081
1056
}
1082
1057
1058
+ @ Override
1083
1059
public String [] getTableNames () {
1084
1060
final String [] tableNames = new String [getTableSpan ()];
1085
1061
for ( int i = 0 ; i < tableNames .length ; i ++ ) {
@@ -1396,7 +1372,7 @@ protected TableReferenceJoin generateTableReferenceJoin(
1396
1372
generateJoinPredicate (
1397
1373
lhs ,
1398
1374
joinedTableReference ,
1399
- getKeyColumnNames (),
1375
+ getIdentifierColumnNames (),
1400
1376
targetColumns ,
1401
1377
creationState
1402
1378
)
@@ -1547,7 +1523,7 @@ public Object initializeLazyProperty(String fieldName, Object entity, SharedSess
1547
1523
1548
1524
}
1549
1525
1550
- public Object getCollectionKey (
1526
+ public static Object getCollectionKey (
1551
1527
CollectionPersister persister ,
1552
1528
Object owner ,
1553
1529
EntityEntry ownerEntry ,
@@ -2267,20 +2243,20 @@ public boolean hasFormulaProperties() {
2267
2243
return hasFormulaProperties ;
2268
2244
}
2269
2245
2270
- @ Override
2271
2246
public FetchMode getFetchMode (int i ) {
2272
2247
return subclassPropertyFetchModeClosure [i ];
2273
2248
}
2274
2249
2275
- @ Override
2276
2250
public Type getSubclassPropertyType (int i ) {
2277
2251
return subclassPropertyTypeClosure [i ];
2278
2252
}
2279
2253
2254
+ @ Override
2280
2255
public int countSubclassProperties () {
2281
2256
return subclassPropertyTypeClosure .length ;
2282
2257
}
2283
2258
2259
+ @ Override
2284
2260
public String [] getSubclassPropertyColumnNames (int i ) {
2285
2261
return subclassPropertyColumnNameClosure [i ];
2286
2262
}
@@ -2639,17 +2615,6 @@ public String getSelectByUniqueKeyString(String[] propertyNames, String[] column
2639
2615
return select .toStatementString ();
2640
2616
}
2641
2617
2642
- @ Internal
2643
- public boolean hasLazyDirtyFields (int [] dirtyFields ) {
2644
- final boolean [] propertyLaziness = getPropertyLaziness ();
2645
- for ( int i = 0 ; i < dirtyFields .length ; i ++ ) {
2646
- if ( propertyLaziness [dirtyFields [i ]] ) {
2647
- return true ;
2648
- }
2649
- }
2650
- return false ;
2651
- }
2652
-
2653
2618
@ Override
2654
2619
public GeneratedValuesMutationDelegate getInsertDelegate () {
2655
2620
return insertDelegate ;
@@ -2660,34 +2625,25 @@ public GeneratedValuesMutationDelegate getUpdateDelegate() {
2660
2625
return updateDelegate ;
2661
2626
}
2662
2627
2663
- protected EntityTableMapping [] getTableMappings () {
2628
+ @ Override
2629
+ public EntityTableMapping [] getTableMappings () {
2664
2630
return tableMappings ;
2665
2631
}
2666
2632
2667
- public EntityTableMapping getTableMapping (int i ) {
2633
+ protected EntityTableMapping getTableMapping (int i ) {
2668
2634
return tableMappings [i ];
2669
2635
}
2670
2636
2671
2637
/**
2672
2638
* Unfortunately we cannot directly use `SelectableMapping#getContainingTableExpression()`
2673
2639
* as that blows up for attributes declared on super-type for union-subclass mappings
2674
2640
*/
2641
+ @ Override
2675
2642
public String physicalTableNameForMutation (SelectableMapping selectableMapping ) {
2676
2643
assert !selectableMapping .isFormula ();
2677
2644
return selectableMapping .getContainingTableExpression ();
2678
2645
}
2679
2646
2680
- public EntityTableMapping getPhysicalTableMappingForMutation (SelectableMapping selectableMapping ) {
2681
- final String tableNameForMutation = physicalTableNameForMutation ( selectableMapping );
2682
- for ( int i = 0 ; i < tableMappings .length ; i ++ ) {
2683
- if ( tableNameForMutation .equals ( tableMappings [i ].getTableName () ) ) {
2684
- return tableMappings [i ];
2685
- }
2686
- }
2687
-
2688
- throw new IllegalArgumentException ( "Unable to resolve TableMapping for selectable - " + selectableMapping );
2689
- }
2690
-
2691
2647
@ Override
2692
2648
public EntityMappingType getTargetPart () {
2693
2649
return this ;
@@ -2855,7 +2811,7 @@ public TableGroup createRootTableGroup(
2855
2811
joinedTableReference ,
2856
2812
needsDiscriminator ()
2857
2813
? getRootTableKeyColumnNames ()
2858
- : getKeyColumnNames (),
2814
+ : getIdentifierColumnNames (),
2859
2815
getSubclassTableKeyColumns ( i ),
2860
2816
creationState
2861
2817
)
@@ -3242,8 +3198,6 @@ protected GeneratedValuesMutationDelegate createUpdateDelegate() {
3242
3198
return GeneratedValuesHelper .getGeneratedValuesDelegate ( this , UPDATE );
3243
3199
}
3244
3200
3245
- public abstract String [][] getContraintOrderedTableKeyColumnClosure ();
3246
-
3247
3201
private static class TableMappingBuilder {
3248
3202
private final String tableName ;
3249
3203
private final int relativePosition ;
@@ -3478,9 +3432,11 @@ protected DeleteCoordinator buildDeleteCoordinator() {
3478
3432
}
3479
3433
}
3480
3434
3435
+ @ Override
3481
3436
public void addDiscriminatorToInsertGroup (MutationGroupBuilder insertGroupBuilder ) {
3482
3437
}
3483
3438
3439
+ @ Override
3484
3440
public void addSoftDeleteToInsertGroup (MutationGroupBuilder insertGroupBuilder ) {
3485
3441
if ( softDeleteMapping != null ) {
3486
3442
final TableInsertBuilder insertBuilder = insertGroupBuilder .getTableDetailsBuilder ( getIdentifierTableName () );
@@ -3787,10 +3743,6 @@ public final String getEntityName() {
3787
3743
return entityMetamodel .getName ();
3788
3744
}
3789
3745
3790
- public boolean isPolymorphic () {
3791
- return entityMetamodel .isPolymorphic ();
3792
- }
3793
-
3794
3746
@ Override
3795
3747
public boolean isInherited () {
3796
3748
return entityMetamodel .isInherited ();
@@ -4029,10 +3981,6 @@ public EntityMappingType resolveConcreteProxyTypeForId(Object id, SharedSessionC
4029
3981
return concreteTypeLoader .getConcreteType ( id , session );
4030
3982
}
4031
3983
4032
- public String [] getKeyColumnNames () {
4033
- return getIdentifierColumnNames ();
4034
- }
4035
-
4036
3984
/**
4037
3985
* {@inheritDoc}
4038
3986
*
@@ -4151,6 +4099,7 @@ public boolean[] getPropertyCheckability() {
4151
4099
return entityMetamodel .getPropertyCheckability ();
4152
4100
}
4153
4101
4102
+ @ Override
4154
4103
public boolean [] getNonLazyPropertyUpdateability () {
4155
4104
return entityMetamodel .getNonlazyPropertyUpdateability ();
4156
4105
}
@@ -4398,6 +4347,7 @@ && hasSubclasses()
4398
4347
return this ;
4399
4348
}
4400
4349
4350
+ @ Override
4401
4351
public boolean hasMultipleTables () {
4402
4352
return false ;
4403
4353
}
@@ -4621,7 +4571,12 @@ public BytecodeEnhancementMetadata getBytecodeEnhancementMetadata() {
4621
4571
return entityMetamodel .getBytecodeEnhancementMetadata ();
4622
4572
}
4623
4573
4624
- public int determineTableNumberForColumn (String columnName ) {
4574
+ @ Override
4575
+ public String getTableNameForColumn (String columnName ) {
4576
+ return getTableName ( determineTableNumberForColumn ( columnName ) );
4577
+ }
4578
+
4579
+ protected int determineTableNumberForColumn (String columnName ) {
4625
4580
return 0 ;
4626
4581
}
4627
4582
0 commit comments