@@ -5482,8 +5482,6 @@ public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SharedSes
5482
5482
return accessOptimizer .getPropertyValues ( entity );
5483
5483
}
5484
5484
5485
- final Collection <AttributeMapping > attributeMappings = getAttributeMappings ();
5486
-
5487
5485
final Object [] result = new Object [this .attributeMappings .size ()];
5488
5486
for ( int i = 0 ; i < this .attributeMappings .size (); i ++ ) {
5489
5487
result [i ] = this .attributeMappings .get ( i ).getPropertyAccess ().getGetter ().getForInsert (
@@ -6102,7 +6100,7 @@ public CacheEntry buildCacheEntry(Object entity, Object[] state, Object version,
6102
6100
private List <AttributeMapping > attributeMappings ;
6103
6101
private List <Fetchable > staticFetchableList ;
6104
6102
6105
- private ReflectionOptimizer .AccessOptimizer accessOptimizer ;
6103
+ protected ReflectionOptimizer .AccessOptimizer accessOptimizer ;
6106
6104
6107
6105
@ Override
6108
6106
public void visitAttributeMappings (Consumer <AttributeMapping > action ) {
@@ -6142,17 +6140,7 @@ public void prepareMappingModel(MappingModelCreationProcess creationProcess) {
6142
6140
);
6143
6141
}
6144
6142
6145
- if ( getDiscriminatorType () == null && shouldProcessSuperMapping () ) {
6146
- discriminatorMapping = null ;
6147
- }
6148
- else {
6149
- discriminatorMapping = new EntityDiscriminatorMappingImpl (
6150
- this ,
6151
- getRootTableName (),
6152
- getDiscriminatorColumnName (),
6153
- (BasicType ) getDiscriminatorType ()
6154
- );
6155
- }
6143
+ buildDiscriminatorMapping ();
6156
6144
6157
6145
// todo (6.0) : support for natural-id not yet implemented
6158
6146
naturalIdMapping = null ;
@@ -6165,14 +6153,13 @@ public void prepareMappingModel(MappingModelCreationProcess creationProcess) {
6165
6153
.getEntityBinding ( getEntityName () );
6166
6154
6167
6155
final EntityMetamodel currentEntityMetamodel = this .getEntityMetamodel ();
6168
-
6169
- int stateArrayPosition = superMappingType == null ? 0 : superMappingType .getNumberOfAttributeMappings ();
6156
+ int stateArrayPosition = getStateArrayInitialPosition ( creationProcess );
6170
6157
6171
6158
for ( int i = 0 ; i < currentEntityMetamodel .getPropertySpan (); i ++ ) {
6172
6159
final NonIdentifierAttribute runtimeAttrDefinition = currentEntityMetamodel .getProperties ()[i ];
6173
6160
final Property bootProperty = bootEntityDescriptor .getProperty ( runtimeAttrDefinition .getName () );
6174
6161
6175
- if ( superMappingType != null && superMappingType .findAttributeMapping ( bootProperty .getName () ) != null && shouldProcessSuperMapping () ) {
6162
+ if ( superMappingType != null && superMappingType .findAttributeMapping ( bootProperty .getName () ) != null ) {
6176
6163
// its defined on the super-type, skip it here
6177
6164
}
6178
6165
else {
@@ -6201,6 +6188,33 @@ public void prepareMappingModel(MappingModelCreationProcess creationProcess) {
6201
6188
}
6202
6189
}
6203
6190
6191
+ protected int getStateArrayInitialPosition (MappingModelCreationProcess creationProcess ) {
6192
+ // todo (6.0) not sure this is correct in case of SingleTable Inheritance and for Table per class when the selection is the root
6193
+ int stateArrayPosition ;
6194
+ if ( superMappingType != null ) {
6195
+ ( (InFlightEntityMappingType ) superMappingType ).prepareMappingModel ( creationProcess );
6196
+ stateArrayPosition = superMappingType .getNumberOfAttributeMappings ();
6197
+ }
6198
+ else {
6199
+ stateArrayPosition = 0 ;
6200
+ }
6201
+ return stateArrayPosition ;
6202
+ }
6203
+
6204
+ protected void buildDiscriminatorMapping () {
6205
+ if ( getDiscriminatorType () == null ) {
6206
+ discriminatorMapping = null ;
6207
+ }
6208
+ else {
6209
+ discriminatorMapping = new EntityDiscriminatorMappingImpl (
6210
+ this ,
6211
+ getRootTableName (),
6212
+ getDiscriminatorColumnName (),
6213
+ (BasicType ) getDiscriminatorType ()
6214
+ );
6215
+ }
6216
+ }
6217
+
6204
6218
protected boolean shouldProcessSuperMapping (){
6205
6219
return true ;
6206
6220
}
@@ -6524,6 +6538,7 @@ public void visitFetchables(
6524
6538
EntityMappingType treatTargetType ) {
6525
6539
if ( treatTargetType == null ) {
6526
6540
getStaticFetchableList ().forEach ( fetchableConsumer );
6541
+ // staticFetchableList.forEach( fetchableConsumer );
6527
6542
// EARLY EXIT!!!
6528
6543
return ;
6529
6544
}
0 commit comments