HHH-18675: Fix for testcase. If property is 'synthetic' then create no attribute for the jpa model.
This commit is contained in:
parent
fcba4ed25d
commit
bc4804ab09
|
@ -477,7 +477,7 @@ public class Property implements Serializable, MetaAttributable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Property copy() {
|
public Property copy() {
|
||||||
final Property property = new Property();
|
final Property property = this instanceof SyntheticProperty ? new SyntheticProperty() : new Property();
|
||||||
property.setName( getName() );
|
property.setName( getName() );
|
||||||
property.setValue( getValue() );
|
property.setValue( getValue() );
|
||||||
property.setCascade( getCascade() );
|
property.setCascade( getCascade() );
|
||||||
|
|
|
@ -55,9 +55,9 @@ import java.util.Set;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
import static java.util.Collections.unmodifiableMap;
|
import static java.util.Collections.unmodifiableMap;
|
||||||
|
import static java.util.Objects.nonNull;
|
||||||
import static org.hibernate.metamodel.internal.InjectionHelper.injectField;
|
import static org.hibernate.metamodel.internal.InjectionHelper.injectField;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines a context for storing information during the building of the {@link MappingMetamodelImpl}.
|
* Defines a context for storing information during the building of the {@link MappingMetamodelImpl}.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -274,11 +274,12 @@ public class MetadataContext {
|
||||||
attribute = factoryFunction.apply( entityType, genericProperty );
|
attribute = factoryFunction.apply( entityType, genericProperty );
|
||||||
if ( !property.isGeneric() ) {
|
if ( !property.isGeneric() ) {
|
||||||
final PersistentAttribute<X, ?> concreteAttribute = factoryFunction.apply( entityType, property );
|
final PersistentAttribute<X, ?> concreteAttribute = factoryFunction.apply( entityType, property );
|
||||||
@SuppressWarnings("unchecked")
|
if (nonNull(concreteAttribute)) {
|
||||||
final AttributeContainer<X> attributeContainer = (AttributeContainer<X>) entityType;
|
@SuppressWarnings("unchecked") final AttributeContainer<X> attributeContainer = (AttributeContainer<X>) entityType;
|
||||||
attributeContainer.getInFlightAccess().addConcreteGenericAttribute(concreteAttribute);
|
attributeContainer.getInFlightAccess().addConcreteGenericAttribute(concreteAttribute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
attribute = factoryFunction.apply( entityType, property );
|
attribute = factoryFunction.apply( entityType, property );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue