finally move propertyHolder from AnnotatedColumn

This commit is contained in:
Gavin King 2022-10-31 02:10:37 +01:00
parent 585522fde1
commit 18003b92dc
7 changed files with 80 additions and 68 deletions

View File

@ -72,8 +72,6 @@ public class AnnotatedColumn {
private boolean updatable = true; private boolean updatable = true;
private String explicitTableName; // the JPA @Column annotation lets you specify a table name private String explicitTableName; // the JPA @Column annotation lets you specify a table name
protected Map<String, Join> joins; protected Map<String, Join> joins;
@Deprecated // use AnnotatedColumns.propertyHolder
protected PropertyHolder propertyHolder;
private boolean isImplicit; private boolean isImplicit;
public String sqlType; public String sqlType;
private Long length; private Long length;
@ -358,7 +356,7 @@ public class AnnotatedColumn {
Identifier implicitName = normalizer.normalizeIdentifierQuoting( Identifier implicitName = normalizer.normalizeIdentifierQuoting(
implicitNamingStrategy.determineBasicColumnName( implicitNamingStrategy.determineBasicColumnName(
new ImplicitBasicColumnNameSource() { new ImplicitBasicColumnNameSource() {
final AttributePath attributePath = AttributePath.parse(propertyName); final AttributePath attributePath = AttributePath.parse( propertyName );
@Override @Override
public AttributePath getAttributePath() { public AttributePath getAttributePath() {
@ -424,12 +422,7 @@ public class AnnotatedColumn {
} }
public PropertyHolder getPropertyHolder() { public PropertyHolder getPropertyHolder() {
return propertyHolder; //TODO: change this to delegate to the parent return parent.getPropertyHolder();
}
@Deprecated // use AnnotatedColumns.setPropertyHolder() instead
public void setPropertyHolder(PropertyHolder propertyHolder) {
this.propertyHolder = propertyHolder;
} }
protected void setMappingColumn(Column mappingColumn) { protected void setMappingColumn(Column mappingColumn) {
@ -502,7 +495,7 @@ public class AnnotatedColumn {
//TODO: move to AnnotatedColumns //TODO: move to AnnotatedColumns
public boolean isSecondary() { public boolean isSecondary() {
if ( propertyHolder == null ) { if ( getPropertyHolder() == null ) {
throw new AssertionFailure( "Should not call isSecondary() on column w/o persistent class defined" ); throw new AssertionFailure( "Should not call isSecondary() on column w/o persistent class defined" );
} }
return isNotEmpty( explicitTableName ) return isNotEmpty( explicitTableName )
@ -680,11 +673,11 @@ public class AnnotatedColumn {
formulaColumn.setFormula( formulaAnn.value() ); formulaColumn.setFormula( formulaAnn.value() );
formulaColumn.setImplicit( false ); formulaColumn.setImplicit( false );
formulaColumn.setBuildingContext( context ); formulaColumn.setBuildingContext( context );
formulaColumn.setPropertyHolder( propertyHolder ); // formulaColumn.setPropertyHolder( propertyHolder );
formulaColumn.bind();
final AnnotatedColumns result = new AnnotatedColumns(); final AnnotatedColumns result = new AnnotatedColumns();
result.setPropertyHolder( propertyHolder ); result.setPropertyHolder( propertyHolder );
result.setColumns( new AnnotatedColumn[] {formulaColumn} ); result.setColumns( new AnnotatedColumn[] {formulaColumn} );
formulaColumn.bind();
return result; return result;
} }
else { else {
@ -774,8 +767,8 @@ public class AnnotatedColumn {
); );
} }
final AnnotatedColumns result = new AnnotatedColumns(); final AnnotatedColumns result = new AnnotatedColumns();
result.setPropertyHolder(propertyHolder); result.setPropertyHolder( propertyHolder );
result.setColumns(columns); result.setColumns( columns );
return result; return result;
} }
@ -809,7 +802,7 @@ public class AnnotatedColumn {
column.setLength( (long) col.length() ); column.setLength( (long) col.length() );
column.setPrecision( col.precision() ); column.setPrecision( col.precision() );
column.setScale( col.scale() ); column.setScale( col.scale() );
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
column.setPropertyName( getRelativePath( propertyHolder, inferredData.getPropertyName() ) ); column.setPropertyName( getRelativePath( propertyHolder, inferredData.getPropertyName() ) );
column.setNullable( col.nullable() ); //TODO force to not null if available? This is a (bad) user choice. column.setNullable( col.nullable() ); //TODO force to not null if available? This is a (bad) user choice.
if ( comment != null ) { if ( comment != null ) {
@ -824,7 +817,10 @@ public class AnnotatedColumn {
column.applyColumnDefault( inferredData, length ); column.applyColumnDefault( inferredData, length );
column.applyGeneratedAs( inferredData, length ); column.applyGeneratedAs( inferredData, length );
column.applyCheckConstraint( inferredData, length ); column.applyCheckConstraint( inferredData, length );
column.extractDataFromPropertyData( inferredData ); column.extractDataFromPropertyData( propertyHolder, inferredData );
AnnotatedColumns temp = new AnnotatedColumns();
temp.setPropertyHolder( propertyHolder );
temp.setColumns( new AnnotatedColumn[] { column } );
column.bind(); column.bind();
return column; return column;
} }
@ -895,12 +891,12 @@ public class AnnotatedColumn {
} }
//must only be called after all setters are defined and before binding //must only be called after all setters are defined and before binding
private void extractDataFromPropertyData(PropertyData inferredData) { private void extractDataFromPropertyData(PropertyHolder propertyHolder, PropertyData inferredData) {
if ( inferredData != null ) { if ( inferredData != null ) {
XProperty property = inferredData.getProperty(); final XProperty property = inferredData.getProperty();
if ( property != null ) { if ( property != null ) {
if ( getPropertyHolder().isComponent() ) { if ( propertyHolder.isComponent() ) {
processColumnTransformerExpressions( getPropertyHolder().getOverriddenColumnTransformer( logicalColumnName ) ); processColumnTransformerExpressions( propertyHolder.getOverriddenColumnTransformer( logicalColumnName ) );
} }
processColumnTransformerExpressions( property.getAnnotation( ColumnTransformer.class ) ); processColumnTransformerExpressions( property.getAnnotation( ColumnTransformer.class ) );
final ColumnTransformers annotations = property.getAnnotation( ColumnTransformers.class ); final ColumnTransformers annotations = property.getAnnotation( ColumnTransformers.class );
@ -966,7 +962,7 @@ public class AnnotatedColumn {
column.setNullable( false ); column.setNullable( false );
} }
final String propertyName = inferredData.getPropertyName(); final String propertyName = inferredData.getPropertyName();
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
column.setPropertyName( getRelativePath( propertyHolder, propertyName ) ); column.setPropertyName( getRelativePath( propertyHolder, propertyName ) );
column.setJoins( secondaryTables ); column.setJoins( secondaryTables );
column.setBuildingContext( context ); column.setBuildingContext( context );
@ -979,7 +975,10 @@ public class AnnotatedColumn {
column.applyColumnDefault( inferredData, 1 ); column.applyColumnDefault( inferredData, 1 );
column.applyGeneratedAs( inferredData, 1 ); column.applyGeneratedAs( inferredData, 1 );
column.applyCheckConstraint( inferredData, 1 ); column.applyCheckConstraint( inferredData, 1 );
column.extractDataFromPropertyData( inferredData ); column.extractDataFromPropertyData( propertyHolder, inferredData );
AnnotatedColumns temp = new AnnotatedColumns();
temp.setPropertyHolder( propertyHolder );
temp.setColumns( new AnnotatedColumn[] { column } );
column.bind(); column.bind();
return column; return column;
} }
@ -1020,7 +1019,8 @@ public class AnnotatedColumn {
} }
void addIndex(String indexName, boolean inSecondPass) { void addIndex(String indexName, boolean inSecondPass) {
IndexOrUniqueKeySecondPass secondPass = new IndexOrUniqueKeySecondPass( indexName, this, context, false ); final IndexOrUniqueKeySecondPass secondPass =
new IndexOrUniqueKeySecondPass( indexName, this, context, false );
if ( inSecondPass ) { if ( inSecondPass ) {
secondPass.doSecondPass( context.getMetadataCollector().getEntityBindingMap() ); secondPass.doSecondPass( context.getMetadataCollector().getEntityBindingMap() );
} }
@ -1030,7 +1030,8 @@ public class AnnotatedColumn {
} }
void addUniqueKey(String uniqueKeyName, boolean inSecondPass) { void addUniqueKey(String uniqueKeyName, boolean inSecondPass) {
IndexOrUniqueKeySecondPass secondPass = new IndexOrUniqueKeySecondPass( uniqueKeyName, this, context, true ); final IndexOrUniqueKeySecondPass secondPass =
new IndexOrUniqueKeySecondPass( uniqueKeyName, this, context, true );
if ( inSecondPass ) { if ( inSecondPass ) {
secondPass.doSecondPass( context.getMetadataCollector().getEntityBindingMap() ); secondPass.doSecondPass( context.getMetadataCollector().getEntityBindingMap() );
} }

View File

@ -115,7 +115,7 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
formulaColumn.setFormula( joinFormula.value() ); formulaColumn.setFormula( joinFormula.value() );
formulaColumn.setReferencedColumn( joinFormula.referencedColumnName() ); formulaColumn.setReferencedColumn( joinFormula.referencedColumnName() );
formulaColumn.setBuildingContext( buildingContext ); formulaColumn.setBuildingContext( buildingContext );
formulaColumn.setPropertyHolder( propertyHolder ); // formulaColumn.setPropertyHolder( propertyHolder );
formulaColumn.setPropertyName( getRelativePath( propertyHolder, propertyName ) ); formulaColumn.setPropertyName( getRelativePath( propertyHolder, propertyName ) );
formulaColumn.setJoins( joins ); formulaColumn.setJoins( joins );
formulaColumn.bind(); formulaColumn.bind();
@ -161,7 +161,7 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
column.setLogicalColumnName( propertyName + defaultColumnSuffix ); column.setLogicalColumnName( propertyName + defaultColumnSuffix );
} }
column.setJoins( joins ); column.setJoins( joins );
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
column.setPropertyName( getRelativePath( propertyHolder, propertyName ) ); column.setPropertyName( getRelativePath( propertyHolder, propertyName ) );
column.setImplicit( false ); column.setImplicit( false );
column.bind(); column.bind();
@ -176,7 +176,7 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
MetadataBuildingContext context) { MetadataBuildingContext context) {
final AnnotatedJoinColumn column = new AnnotatedJoinColumn(); final AnnotatedJoinColumn column = new AnnotatedJoinColumn();
column.setJoins( joins ); column.setJoins( joins );
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
column.setPropertyName( getRelativePath( propertyHolder, propertyName ) ); column.setPropertyName( getRelativePath( propertyHolder, propertyName ) );
// property name + suffix is an "explicit" column name // property name + suffix is an "explicit" column name
if ( isNotEmpty( defaultColumnSuffix ) ) { if ( isNotEmpty( defaultColumnSuffix ) ) {
@ -273,7 +273,7 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
column.setSqlType( columnDef ); column.setSqlType( columnDef );
column.setLogicalColumnName( logicalColumnName ); column.setLogicalColumnName( logicalColumnName );
column.setReferencedColumn( referencedColumnName ); column.setReferencedColumn( referencedColumnName );
column.setPropertyHolder(propertyHolder); // column.setPropertyHolder(propertyHolder);
column.setJoins(joins); column.setJoins(joins);
column.setBuildingContext(context); column.setBuildingContext(context);
column.setImplicit( false ); column.setImplicit( false );
@ -290,7 +290,7 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
final AnnotatedJoinColumn column = new AnnotatedJoinColumn(); final AnnotatedJoinColumn column = new AnnotatedJoinColumn();
final ObjectNameNormalizer normalizer = context.getObjectNameNormalizer(); final ObjectNameNormalizer normalizer = context.getObjectNameNormalizer();
column.setLogicalColumnName( normalizer.normalizeIdentifierQuotingAsString(defaultColumnName) ); column.setLogicalColumnName( normalizer.normalizeIdentifierQuotingAsString(defaultColumnName) );
column.setPropertyHolder(propertyHolder); // column.setPropertyHolder( propertyHolder );
column.setJoins(joins); column.setJoins(joins);
column.setBuildingContext(context); column.setBuildingContext(context);
column.setImplicit( true ); column.setImplicit( true );
@ -504,7 +504,7 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
final AnnotatedJoinColumn column = new AnnotatedJoinColumn(); final AnnotatedJoinColumn column = new AnnotatedJoinColumn();
column.setImplicit( true ); column.setImplicit( true );
column.setNullable( false ); //I break the spec, but it's for good column.setNullable( false ); //I break the spec, but it's for good
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
column.setPropertyName( getRelativePath( propertyHolder, propertyName ) ); column.setPropertyName( getRelativePath( propertyHolder, propertyName ) );
column.setJoins( secondaryTables ); column.setJoins( secondaryTables );
column.setBuildingContext( context ); column.setBuildingContext( context );
@ -520,7 +520,7 @@ public class AnnotatedJoinColumn extends AnnotatedColumn {
JoinColumn joinColumn) { JoinColumn joinColumn) {
final AnnotatedJoinColumn column = new AnnotatedJoinColumn(); final AnnotatedJoinColumn column = new AnnotatedJoinColumn();
column.setImplicit( true ); column.setImplicit( true );
column.setPropertyHolder(propertyHolder); // column.setPropertyHolder( propertyHolder );
column.setPropertyName( getRelativePath( propertyHolder, propertyName ) ); column.setPropertyName( getRelativePath( propertyHolder, propertyName ) );
column.setJoins( secondaryTables ); column.setJoins( secondaryTables );
column.setBuildingContext( context ); column.setBuildingContext( context );

View File

@ -48,7 +48,6 @@ import static org.hibernate.internal.util.StringHelper.qualify;
public class AnnotatedJoinColumns extends AnnotatedColumns { public class AnnotatedJoinColumns extends AnnotatedColumns {
private AnnotatedJoinColumn[] columns; private AnnotatedJoinColumn[] columns;
private PropertyHolder propertyHolder;
private String propertyName; // this is really a .-separated property path private String propertyName; // this is really a .-separated property path
private MetadataBuildingContext buildingContext; private MetadataBuildingContext buildingContext;
@ -247,14 +246,6 @@ public class AnnotatedJoinColumns extends AnnotatedColumns {
return mappedByTableName; return mappedByTableName;
} }
public PropertyHolder getPropertyHolder() {
return propertyHolder;
}
public void setPropertyHolder(PropertyHolder propertyHolder) {
this.propertyHolder = propertyHolder;
}
/** /**
* Override persistent class on oneToMany Cases for late settings * Override persistent class on oneToMany Cases for late settings
* Must only be used on second level pass binding * Must only be used on second level pass binding
@ -264,15 +255,16 @@ public class AnnotatedJoinColumns extends AnnotatedColumns {
Map<String, Join> joins, Map<String, Join> joins,
Map<XClass, InheritanceState> inheritanceStatePerClass) { Map<XClass, InheritanceState> inheritanceStatePerClass) {
// TODO shouldn't we deduce the class name from the persistentClass? // TODO shouldn't we deduce the class name from the persistentClass?
propertyHolder = buildPropertyHolder( final PropertyHolder propertyHolder = buildPropertyHolder(
persistentClass, persistentClass,
joins, joins,
buildingContext, buildingContext,
inheritanceStatePerClass inheritanceStatePerClass
); );
for ( AnnotatedJoinColumn column : columns ) { setPropertyHolder( propertyHolder );
column.setPropertyHolder( propertyHolder ); // for ( AnnotatedJoinColumn column : columns ) {
} // column.setPropertyHolder( propertyHolder );
// }
} }
public void setBuildingContext(MetadataBuildingContext buildingContext) { public void setBuildingContext(MetadataBuildingContext buildingContext) {
@ -479,7 +471,7 @@ public class AnnotatedJoinColumns extends AnnotatedColumns {
String.format( String.format(
Locale.ENGLISH, Locale.ENGLISH,
"Association '%s' is 'mappedBy' a property '%s' of entity '%s' with no columns", "Association '%s' is 'mappedBy' a property '%s' of entity '%s' with no columns",
propertyHolder.getPath(), getPropertyHolder().getPath(),
getMappedByPropertyName(), getMappedByPropertyName(),
getMappedByEntityName() getMappedByEntityName()
) )
@ -491,9 +483,9 @@ public class AnnotatedJoinColumns extends AnnotatedColumns {
String.format( String.format(
Locale.ENGLISH, Locale.ENGLISH,
"Association '%s' is 'mappedBy' a property '%s' of entity '%s' which maps to a formula", "Association '%s' is 'mappedBy' a property '%s' of entity '%s' which maps to a formula",
propertyHolder.getPath(), getPropertyHolder().getPath(),
getMappedByPropertyName(), getMappedByPropertyName(),
propertyHolder.getPath() getPropertyHolder().getPath()
) )
); );
} }
@ -502,9 +494,9 @@ public class AnnotatedJoinColumns extends AnnotatedColumns {
String.format( String.format(
Locale.ENGLISH, Locale.ENGLISH,
"Association '%s' is 'mappedBy' a property '%s' of entity '%s' with multiple columns", "Association '%s' is 'mappedBy' a property '%s' of entity '%s' with multiple columns",
propertyHolder.getPath(), getPropertyHolder().getPath(),
getMappedByPropertyName(), getMappedByPropertyName(),
propertyHolder.getPath() getPropertyHolder().getPath()
) )
); );
} }

View File

@ -60,7 +60,8 @@ public class IndexColumn extends AnnotatedColumn {
column.setLogicalColumnName( inferredData.getPropertyName() + "_ORDER" ); //JPA default name column.setLogicalColumnName( inferredData.getPropertyName() + "_ORDER" ); //JPA default name
column.setImplicit( true ); column.setImplicit( true );
column.setBuildingContext( context ); column.setBuildingContext( context );
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
createParent( propertyHolder, column );
column.bind(); column.bind();
} }
@ -71,6 +72,12 @@ public class IndexColumn extends AnnotatedColumn {
return column; return column;
} }
private static void createParent(PropertyHolder propertyHolder, IndexColumn column) {
final AnnotatedColumns columns = new AnnotatedColumns();
columns.setColumns( new AnnotatedColumn[] {column} );
columns.setPropertyHolder( propertyHolder );
}
public int getBase() { public int getBase() {
return base; return base;
} }
@ -82,7 +89,7 @@ public class IndexColumn extends AnnotatedColumn {
/** /**
* JPA 2 {@link OrderColumn @OrderColumn} processing. * JPA 2 {@link OrderColumn @OrderColumn} processing.
* *
* @param ann The OrderColumn annotation instance * @param orderColumn The OrderColumn annotation instance
* @param propertyHolder Information about the property * @param propertyHolder Information about the property
* @param inferredData Yeah, right. Uh... * @param inferredData Yeah, right. Uh...
* @param secondaryTables Any secondary tables available. * @param secondaryTables Any secondary tables available.
@ -90,24 +97,25 @@ public class IndexColumn extends AnnotatedColumn {
* @return The index column * @return The index column
*/ */
public static IndexColumn buildColumnFromAnnotation( public static IndexColumn buildColumnFromAnnotation(
OrderColumn ann, OrderColumn orderColumn,
PropertyHolder propertyHolder, PropertyHolder propertyHolder,
PropertyData inferredData, PropertyData inferredData,
Map<String, Join> secondaryTables, Map<String, Join> secondaryTables,
MetadataBuildingContext buildingContext) { MetadataBuildingContext buildingContext) {
if ( ann != null ) { if ( orderColumn != null ) {
final String sqlType = isEmptyAnnotationValue( ann.columnDefinition() ) ? null : ann.columnDefinition(); final String sqlType = isEmptyAnnotationValue( orderColumn.columnDefinition() ) ? null : orderColumn.columnDefinition();
final String name = isEmptyAnnotationValue( ann.name() ) ? inferredData.getPropertyName() + "_ORDER" : ann.name(); final String name = isEmptyAnnotationValue( orderColumn.name() ) ? inferredData.getPropertyName() + "_ORDER" : orderColumn.name();
//TODO move it to a getter based system and remove the constructor //TODO move it to a getter based system and remove the constructor
final IndexColumn column = new IndexColumn(); final IndexColumn column = new IndexColumn();
column.setLogicalColumnName( name ); column.setLogicalColumnName( name );
column.setSqlType( sqlType ); column.setSqlType( sqlType );
column.setNullable( ann.nullable() ); column.setNullable( orderColumn.nullable() );
column.setJoins( secondaryTables ); column.setJoins( secondaryTables );
column.setInsertable( ann.insertable() ); column.setInsertable( orderColumn.insertable() );
column.setUpdatable( ann.updatable() ); column.setUpdatable( orderColumn.updatable() );
column.setBuildingContext( buildingContext ); column.setBuildingContext( buildingContext );
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
createParent( propertyHolder, column );
column.bind(); column.bind();
return column; return column;
} }
@ -115,7 +123,8 @@ public class IndexColumn extends AnnotatedColumn {
final IndexColumn column = new IndexColumn(); final IndexColumn column = new IndexColumn();
column.setImplicit( true ); column.setImplicit( true );
column.setBuildingContext( buildingContext ); column.setBuildingContext( buildingContext );
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
createParent( propertyHolder, column );
column.bind(); column.bind();
return column; return column;
} }
@ -145,7 +154,8 @@ public class IndexColumn extends AnnotatedColumn {
column.setNullable( ann.nullable() ); column.setNullable( ann.nullable() );
column.setBase( ann.base() ); column.setBase( ann.base() );
column.setBuildingContext( buildingContext ); column.setBuildingContext( buildingContext );
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
createParent( propertyHolder, column );
column.bind(); column.bind();
return column; return column;
} }
@ -153,7 +163,8 @@ public class IndexColumn extends AnnotatedColumn {
final IndexColumn column = new IndexColumn(); final IndexColumn column = new IndexColumn();
column.setImplicit( true ); column.setImplicit( true );
column.setBuildingContext( buildingContext ); column.setBuildingContext( buildingContext );
column.setPropertyHolder( propertyHolder ); // column.setPropertyHolder( propertyHolder );
createParent( propertyHolder, column );
column.bind(); column.bind();
return column; return column;
} }

View File

@ -89,6 +89,8 @@ import org.hibernate.boot.spi.InFlightMetadataCollector;
import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.cfg.AccessType; import org.hibernate.cfg.AccessType;
import org.hibernate.cfg.AnnotatedClassType; import org.hibernate.cfg.AnnotatedClassType;
import org.hibernate.cfg.AnnotatedColumn;
import org.hibernate.cfg.AnnotatedColumns;
import org.hibernate.cfg.AnnotatedDiscriminatorColumn; import org.hibernate.cfg.AnnotatedDiscriminatorColumn;
import org.hibernate.cfg.AnnotatedJoinColumns; import org.hibernate.cfg.AnnotatedJoinColumns;
import org.hibernate.cfg.AnnotationBinder; import org.hibernate.cfg.AnnotationBinder;
@ -788,7 +790,11 @@ public class EntityBinder {
throw new AssertionFailure( "discriminator column should have been built" ); throw new AssertionFailure( "discriminator column should have been built" );
} }
discriminatorColumn.setJoins( secondaryTables ); discriminatorColumn.setJoins( secondaryTables );
discriminatorColumn.setPropertyHolder( propertyHolder ); // discriminatorColumn.setPropertyHolder( propertyHolder );
final AnnotatedColumns columns = new AnnotatedColumns();
columns.setColumns( new AnnotatedColumn[] { discriminatorColumn } );
columns.setPropertyHolder( propertyHolder );
final BasicValue discriminatorColumnBinding = new BasicValue( context, rootClass.getTable() ); final BasicValue discriminatorColumnBinding = new BasicValue( context, rootClass.getTable() );
rootClass.setDiscriminator( discriminatorColumnBinding ); rootClass.setDiscriminator( discriminatorColumnBinding );
discriminatorColumn.linkWithValue( discriminatorColumnBinding ); discriminatorColumn.linkWithValue( discriminatorColumnBinding );

View File

@ -86,11 +86,13 @@ public class ListBinder extends CollectionBinder {
if ( !listValueMapping.isOneToMany() ) { if ( !listValueMapping.isOneToMany() ) {
indexColumn.forceNotNull(); indexColumn.forceNotNull();
} }
indexColumn.setPropertyHolder( valueHolder ); // indexColumn.setPropertyHolder( valueHolder );
final AnnotatedColumns columns = new AnnotatedColumns();
columns.setColumns( new AnnotatedColumn[] { indexColumn } );
columns.setPropertyHolder( valueHolder );
final BasicValueBinder valueBinder = new BasicValueBinder( BasicValueBinder.Kind.LIST_INDEX, buildingContext ); final BasicValueBinder valueBinder = new BasicValueBinder( BasicValueBinder.Kind.LIST_INDEX, buildingContext );
final AnnotatedColumns result = new AnnotatedColumns(); valueBinder.setColumns( columns );
result.setColumns( new AnnotatedColumn[] { indexColumn } );
valueBinder.setColumns(result);
valueBinder.setReturnedClassName( Integer.class.getName() ); valueBinder.setReturnedClassName( Integer.class.getName() );
valueBinder.setType( property, getElementType(), null, null ); valueBinder.setType( property, getElementType(), null, null );
// valueBinder.setExplicitType( "integer" ); // valueBinder.setExplicitType( "integer" );

View File

@ -199,7 +199,7 @@ public class PropertyBinder {
basicValueBinder.setAccessType( accessType ); basicValueBinder.setAccessType( accessType );
SimpleValue propertyValue = basicValueBinder.make(); final SimpleValue propertyValue = basicValueBinder.make();
setValue( propertyValue ); setValue( propertyValue );
return makeProperty(); return makeProperty();
} }