mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 00:55:16 +00:00
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,12 +678,20 @@ private Generator buildIdentifierGenerator(Dialect dialect, RootClass rootClass)
|
|||||||
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
|
||||||
|
if ( value.createGenerator( dialect, rootClass, property )
|
||||||
|
instanceof BeforeExecutionGenerator beforeExecutionGenerator ) {
|
||||||
generator.addGeneratedValuePlan( new ValueGenerationPlan(
|
generator.addGeneratedValuePlan( new ValueGenerationPlan(
|
||||||
value.createGenerator( dialect, rootClass, property ),
|
beforeExecutionGenerator,
|
||||||
getType().isMutable() ? injector( property, getAttributeDeclarer( rootClass ) ) : null,
|
getType().isMutable()
|
||||||
|
? injector( property, getAttributeDeclarer( rootClass ) )
|
||||||
|
: null,
|
||||||
i
|
i
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
throw new IdentifierGenerationException( "Identity generation isn't supported for composite ids" );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return generator;
|
return generator;
|
||||||
@ -755,12 +763,12 @@ public Object locateGenerationContext(SharedSessionContractImplementor session,
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 int getPropertyIndex() {
|
|||||||
|
|
||||||
@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 Object execute(SharedSessionContractImplementor session, Object incomingO
|
|||||||
|
|
||||||
@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 void setStructColumnNames(String[] structColumnNames) {
|
|||||||
|
|
||||||
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…
x
Reference in New Issue
Block a user