report a limitation sooner
This commit is contained in:
parent
2c607e4bd6
commit
cb8b03d392
|
@ -79,7 +79,7 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
private PersistentClass owner;
|
private PersistentClass owner;
|
||||||
private boolean dynamic;
|
private boolean dynamic;
|
||||||
private boolean isKey;
|
private boolean isKey;
|
||||||
private Boolean isGeneric;
|
private transient Boolean isGeneric;
|
||||||
private String roleName;
|
private String roleName;
|
||||||
private MappedSuperclass mappedSuperclass;
|
private MappedSuperclass mappedSuperclass;
|
||||||
private Value discriminator;
|
private Value discriminator;
|
||||||
|
@ -97,7 +97,7 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
private String[] instantiatorPropertyNames;
|
private String[] instantiatorPropertyNames;
|
||||||
|
|
||||||
// cache the status of the type
|
// cache the status of the type
|
||||||
private volatile CompositeType type;
|
private transient volatile CompositeType type;
|
||||||
|
|
||||||
private AggregateColumn aggregateColumn;
|
private AggregateColumn aggregateColumn;
|
||||||
private AggregateColumn parentAggregateColumn;
|
private AggregateColumn parentAggregateColumn;
|
||||||
|
@ -678,11 +678,19 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
if ( !value.getCustomIdGeneratorCreator().isAssigned() ) {
|
if ( !value.getCustomIdGeneratorCreator().isAssigned() ) {
|
||||||
// skip any 'assigned' generators, they would have been
|
// skip any 'assigned' generators, they would have been
|
||||||
// handled by the StandardGenerationContextLocator
|
// handled by the StandardGenerationContextLocator
|
||||||
generator.addGeneratedValuePlan( new ValueGenerationPlan(
|
if ( value.createGenerator( dialect, rootClass, property )
|
||||||
value.createGenerator( dialect, rootClass, property ),
|
instanceof BeforeExecutionGenerator beforeExecutionGenerator ) {
|
||||||
getType().isMutable() ? injector( property, getAttributeDeclarer( rootClass ) ) : null,
|
generator.addGeneratedValuePlan( new ValueGenerationPlan(
|
||||||
i
|
beforeExecutionGenerator,
|
||||||
) );
|
getType().isMutable()
|
||||||
|
? injector( property, getAttributeDeclarer( rootClass ) )
|
||||||
|
: null,
|
||||||
|
i
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new IdentifierGenerationException( "Identity generation isn't supported for composite ids" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -755,12 +763,12 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ValueGenerationPlan implements CompositeNestedGeneratedValueGenerator.GenerationPlan {
|
public static class ValueGenerationPlan implements CompositeNestedGeneratedValueGenerator.GenerationPlan {
|
||||||
private final Generator subgenerator;
|
private final BeforeExecutionGenerator generator;
|
||||||
private final Setter injector;
|
private final Setter injector;
|
||||||
private final int propertyIndex;
|
private final int propertyIndex;
|
||||||
|
|
||||||
public ValueGenerationPlan(Generator subgenerator, Setter injector, int propertyIndex) {
|
public ValueGenerationPlan(BeforeExecutionGenerator generator, Setter injector, int propertyIndex) {
|
||||||
this.subgenerator = subgenerator;
|
this.generator = generator;
|
||||||
this.injector = injector;
|
this.injector = injector;
|
||||||
this.propertyIndex = propertyIndex;
|
this.propertyIndex = propertyIndex;
|
||||||
}
|
}
|
||||||
|
@ -777,9 +785,8 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object execute(SharedSessionContractImplementor session, Object incomingObject) {
|
public Object execute(SharedSessionContractImplementor session, Object incomingObject) {
|
||||||
if ( !subgenerator.generatedOnExecution( incomingObject, session ) ) {
|
if ( !generator.generatedOnExecution( incomingObject, session ) ) {
|
||||||
return ( (BeforeExecutionGenerator) subgenerator)
|
return generator.generate( session, incomingObject, null, INSERT );
|
||||||
.generate( session, incomingObject, null, INSERT );
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new IdentifierGenerationException( "Identity generation isn't supported for composite ids" );
|
throw new IdentifierGenerationException( "Identity generation isn't supported for composite ids" );
|
||||||
|
@ -788,15 +795,15 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerExportables(Database database) {
|
public void registerExportables(Database database) {
|
||||||
if ( subgenerator instanceof ExportableProducer ) {
|
if ( generator instanceof ExportableProducer exportableProducer ) {
|
||||||
( (ExportableProducer) subgenerator).registerExportables( database );
|
exportableProducer.registerExportables( database );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize(SqlStringGenerationContext context) {
|
public void initialize(SqlStringGenerationContext context) {
|
||||||
if ( subgenerator instanceof Configurable) {
|
if ( generator instanceof Configurable configurable ) {
|
||||||
( (Configurable) subgenerator).initialize( context );
|
configurable.initialize( context );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -949,7 +956,8 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable
|
||||||
|
|
||||||
public boolean isGeneric() {
|
public boolean isGeneric() {
|
||||||
if ( isGeneric == null ) {
|
if ( isGeneric == null ) {
|
||||||
isGeneric = getComponentClassName() != null && getComponentClass().getTypeParameters().length != 0;
|
isGeneric = getComponentClassName() != null
|
||||||
|
&& getComponentClass().getTypeParameters().length > 0;
|
||||||
}
|
}
|
||||||
return isGeneric;
|
return isGeneric;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue