Resolved issue with DependandValue resolution
This commit is contained in:
parent
cb2a2bbd58
commit
26339598a5
|
@ -50,7 +50,7 @@ import org.hibernate.type.spi.TypeConfiguration;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicators {
|
||||
public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicators, Resolvable {
|
||||
private static final CoreMessageLogger log = CoreLogging.messageLogger( BasicValue.class );
|
||||
|
||||
private final MetadataBuildingContext buildingContext;
|
||||
|
@ -245,11 +245,13 @@ public class BasicValue extends SimpleValue implements SqlTypeDescriptorIndicato
|
|||
return resolution;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resolve(MetadataBuildingContext buildingContext) {
|
||||
resolve();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resolution<?> resolve() {
|
||||
if ( resolution != null ) {
|
||||
return resolution;
|
||||
|
|
|
@ -17,7 +17,7 @@ import org.hibernate.type.Type;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class DependantValue extends SimpleValue {
|
||||
public class DependantValue extends SimpleValue implements Resolvable {
|
||||
private KeyValue wrappedValue;
|
||||
private boolean nullable;
|
||||
private boolean updateable;
|
||||
|
@ -31,12 +31,15 @@ public class DependantValue extends SimpleValue {
|
|||
return wrappedValue.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeUsingReflection(String className, String propertyName) {}
|
||||
|
||||
|
||||
@Override
|
||||
public Object accept(ValueVisitor visitor) {
|
||||
return visitor.accept(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNullable() {
|
||||
return nullable;
|
||||
|
||||
|
@ -45,7 +48,8 @@ public class DependantValue extends SimpleValue {
|
|||
public void setNullable(boolean nullable) {
|
||||
this.nullable = nullable;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isUpdateable() {
|
||||
return updateable;
|
||||
}
|
||||
|
@ -64,4 +68,19 @@ public class DependantValue extends SimpleValue {
|
|||
&& isSame( wrappedValue, other.wrappedValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resolve(MetadataBuildingContext buildingContext) {
|
||||
resolve();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasicValue.Resolution<?> resolve() {
|
||||
if ( wrappedValue instanceof BasicValue ) {
|
||||
return ( (BasicValue) wrappedValue ).resolve();
|
||||
}
|
||||
// not sure it is ever possible
|
||||
throw new UnsupportedOperationException("Trying to resolve the wrapped value but it is non a BasicValue");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
|
||||
/**
|
||||
* @author Andrea Boriero
|
||||
*/
|
||||
public interface Resolvable {
|
||||
|
||||
boolean resolve(MetadataBuildingContext buildingContext);
|
||||
|
||||
BasicValue.Resolution<?> resolve();
|
||||
}
|
||||
|
|
@ -36,12 +36,14 @@ import org.hibernate.internal.util.collections.CollectionHelper;
|
|||
import org.hibernate.mapping.BasicValue;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.DependantValue;
|
||||
import org.hibernate.mapping.IndexedCollection;
|
||||
import org.hibernate.mapping.KeyValue;
|
||||
import org.hibernate.mapping.OneToMany;
|
||||
import org.hibernate.mapping.OneToOne;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.mapping.Resolvable;
|
||||
import org.hibernate.mapping.Selectable;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.mapping.ToOne;
|
||||
|
@ -277,13 +279,14 @@ public class MappingModelCreationHelper {
|
|||
PropertyAccess propertyAccess,
|
||||
CascadeStyle cascadeStyle,
|
||||
MappingModelCreationProcess creationProcess) {
|
||||
final BasicValue.Resolution<?> resolution = ( (BasicValue) bootProperty.getValue() ).resolve();
|
||||
final Value value = bootProperty.getValue();
|
||||
final BasicValue.Resolution<?> resolution = ( (Resolvable) value ).resolve();
|
||||
|
||||
final BasicValueConverter valueConverter = resolution.getValueConverter();
|
||||
|
||||
final StateArrayContributorMetadataAccess attributeMetadataAccess = entityMappingType -> new StateArrayContributorMetadata() {
|
||||
private final MutabilityPlan mutabilityPlan = resolution.getMutabilityPlan();
|
||||
private final boolean nullable = bootProperty.getValue().isNullable();
|
||||
private final boolean nullable = value.isNullable();
|
||||
private final boolean insertable = bootProperty.isInsertable();
|
||||
private final boolean updateable = bootProperty.isUpdateable();
|
||||
private final boolean includeInOptimisticLocking = bootProperty.isOptimisticLocked();
|
||||
|
|
Loading…
Reference in New Issue