Skip to content

Commit

Permalink
work on aggregate composite identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
dreab8 authored and sebersole committed Nov 21, 2019
1 parent 8e81f54 commit 03c5bd4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 12 deletions.
Expand Up @@ -50,13 +50,17 @@
import org.hibernate.sql.results.spi.DomainResultCreationState;
import org.hibernate.sql.results.spi.Fetch;
import org.hibernate.sql.results.spi.FetchParent;
import org.hibernate.type.descriptor.java.JavaTypeDescriptor;
import org.hibernate.type.spi.TypeConfiguration;

/**
* @author Andrea Boriero
*/
public class EmbeddedIdentifierMappingImpl extends AbstractStateArrayContributorMapping
public class EmbeddedIdentifierMappingImpl
implements EmbeddedIdentifierMapping {
private final String name;
private final MappingType type;
private final StateArrayContributorMetadataAccess attributeMetadataAccess;
private final PropertyAccess propertyAccess;
private final String tableExpression;
private final String[] attrColumnNames;
Expand All @@ -65,21 +69,25 @@ public EmbeddedIdentifierMappingImpl(
String name,
MappingType type,
StateArrayContributorMetadataAccess attributeMetadataAccess,
FetchStrategy mappedFetchStrategy,
int stateArrayPosition,
ManagedMappingType declaringType,
PropertyAccess propertyAccess,
String tableExpression,
String[] attrColumnNames) {
super( name, type, attributeMetadataAccess, mappedFetchStrategy, stateArrayPosition, declaringType );
this.name = name;
this.type = type;
this.attributeMetadataAccess = attributeMetadataAccess;
this.propertyAccess = propertyAccess;
this.tableExpression = tableExpression;
this.attrColumnNames = attrColumnNames;
}

@Override
public JavaTypeDescriptor getJavaTypeDescriptor() {
return getMappedTypeDescriptor().getMappedJavaTypeDescriptor();
}

@Override
public String getPartName() {
return getAttributeName();
return name;
}

@Override
Expand All @@ -94,7 +102,7 @@ public EmbeddableMappingType getEmbeddableTypeDescriptor() {

@Override
public EmbeddableMappingType getMappedTypeDescriptor() {
return (EmbeddableMappingType) super.getMappedTypeDescriptor();
return (EmbeddableMappingType) type;
}

@Override
Expand Down Expand Up @@ -209,7 +217,7 @@ public TableGroupJoin createTableGroupJoin(

@Override
public String getSqlAliasStem() {
return getAttributeName();
return name;
}

@Override
Expand Down Expand Up @@ -254,6 +262,16 @@ else if ( attrMapping.getMappedTypeDescriptor() instanceof TableGroupProducer )
);
}

@Override
public String getFetchableName() {
return name;
}

@Override
public FetchStrategy getMappedFetchStrategy() {
return null;
}

@Override
public Fetch generateFetch(
FetchParent fetchParent,
Expand All @@ -268,7 +286,7 @@ public Fetch generateFetch(
this,
fetchParent,
fetchTiming,
getAttributeMetadataAccess().resolveAttributeMetadata( null ).isNullable(),
attributeMetadataAccess.resolveAttributeMetadata( null ).isNullable(),
creationState
);
}
Expand Down
Expand Up @@ -307,9 +307,6 @@ public static EntityIdentifierMapping buildEncapsulatedCompositeIdentifierMappin
attributeName,
attributeMappingType,
attributeMetadataAccess,
FetchStrategy.IMMEDIATE_JOIN,
0,
entityPersister,
propertyAccess,
rootTableName,
rootTableKeyColumnNames
Expand Down

0 comments on commit 03c5bd4

Please sign in to comment.