remove type parameter from BasicValueBinder
why it ever had one, I can only speculate
This commit is contained in:
parent
fb1650f789
commit
77137f7407
|
@ -814,8 +814,8 @@ public class BinderHelper {
|
||||||
value.setLazy( lazy );
|
value.setLazy( lazy );
|
||||||
value.setCascadeDeleteEnabled( cascadeOnDelete );
|
value.setCascadeDeleteEnabled( cascadeOnDelete );
|
||||||
|
|
||||||
final BasicValueBinder<?> discriminatorValueBinder =
|
final BasicValueBinder discriminatorValueBinder =
|
||||||
new BasicValueBinder<>( BasicValueBinder.Kind.ANY_DISCRIMINATOR, context );
|
new BasicValueBinder( BasicValueBinder.Kind.ANY_DISCRIMINATOR, context );
|
||||||
|
|
||||||
final AnnotatedColumn[] discriminatorColumns = buildColumnOrFormulaFromAnnotation(
|
final AnnotatedColumn[] discriminatorColumns = buildColumnOrFormulaFromAnnotation(
|
||||||
discriminatorColumn,
|
discriminatorColumn,
|
||||||
|
@ -853,7 +853,7 @@ public class BinderHelper {
|
||||||
);
|
);
|
||||||
value.setDiscriminatorValueMappings( discriminatorValueMappings );
|
value.setDiscriminatorValueMappings( discriminatorValueMappings );
|
||||||
|
|
||||||
BasicValueBinder<?> keyValueBinder = new BasicValueBinder<>( BasicValueBinder.Kind.ANY_KEY, context );
|
BasicValueBinder keyValueBinder = new BasicValueBinder( BasicValueBinder.Kind.ANY_KEY, context );
|
||||||
assert keyColumns.length == 1;
|
assert keyColumns.length == 1;
|
||||||
keyColumns[0].setTable( value.getTable() );
|
keyColumns[0].setTable( value.getTable() );
|
||||||
keyValueBinder.setColumns( keyColumns );
|
keyValueBinder.setColumns( keyColumns );
|
||||||
|
|
|
@ -16,9 +16,9 @@ import org.hibernate.mapping.PersistentClass;
|
||||||
* @author Sharath Reddy
|
* @author Sharath Reddy
|
||||||
*/
|
*/
|
||||||
public class SetBasicValueTypeSecondPass implements SecondPass {
|
public class SetBasicValueTypeSecondPass implements SecondPass {
|
||||||
private final BasicValueBinder<?> binder;
|
private final BasicValueBinder binder;
|
||||||
|
|
||||||
public SetBasicValueTypeSecondPass(BasicValueBinder<?> val) {
|
public SetBasicValueTypeSecondPass(BasicValueBinder val) {
|
||||||
binder = val;
|
binder = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,10 @@ import org.hibernate.usertype.UserCollectionType;
|
||||||
* @author Anthony Patricio
|
* @author Anthony Patricio
|
||||||
*/
|
*/
|
||||||
public class ArrayBinder extends ListBinder {
|
public class ArrayBinder extends ListBinder {
|
||||||
public ArrayBinder(Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver, MetadataBuildingContext buildingContext) {
|
|
||||||
|
public ArrayBinder(
|
||||||
|
Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver,
|
||||||
|
MetadataBuildingContext buildingContext) {
|
||||||
super( customTypeBeanResolver, buildingContext );
|
super( customTypeBeanResolver, buildingContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,10 @@ import org.hibernate.usertype.UserCollectionType;
|
||||||
* @author Matthew Inger
|
* @author Matthew Inger
|
||||||
*/
|
*/
|
||||||
public class BagBinder extends CollectionBinder {
|
public class BagBinder extends CollectionBinder {
|
||||||
public BagBinder(Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver, MetadataBuildingContext context) {
|
|
||||||
|
public BagBinder(
|
||||||
|
Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver,
|
||||||
|
MetadataBuildingContext context) {
|
||||||
super( customTypeBeanResolver, false, context );
|
super( customTypeBeanResolver, false, context );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ import static org.hibernate.cfg.annotations.HCANNHelper.findAnnotation;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class BasicValueBinder<T> implements JdbcTypeIndicators {
|
public class BasicValueBinder implements JdbcTypeIndicators {
|
||||||
|
|
||||||
// todo (6.0) : In light of how we want to build Types (specifically BasicTypes) moving forward this class should undergo major changes
|
// todo (6.0) : In light of how we want to build Types (specifically BasicTypes) moving forward this class should undergo major changes
|
||||||
// see the comments in #setType
|
// see the comments in #setType
|
||||||
|
@ -163,7 +163,7 @@ public class BasicValueBinder<T> implements JdbcTypeIndicators {
|
||||||
|
|
||||||
public BasicValueBinder(Kind kind, MetadataBuildingContext buildingContext) {
|
public BasicValueBinder(Kind kind, MetadataBuildingContext buildingContext) {
|
||||||
assert kind != null;
|
assert kind != null;
|
||||||
assert buildingContext != null;
|
assert buildingContext != null;
|
||||||
|
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.buildingContext = buildingContext;
|
this.buildingContext = buildingContext;
|
||||||
|
|
|
@ -1785,8 +1785,8 @@ public abstract class CollectionBinder {
|
||||||
else {
|
else {
|
||||||
holder.prepare(property);
|
holder.prepare(property);
|
||||||
|
|
||||||
final BasicValueBinder<?> elementBinder =
|
final BasicValueBinder elementBinder =
|
||||||
new BasicValueBinder<>( BasicValueBinder.Kind.COLLECTION_ELEMENT, buildingContext);
|
new BasicValueBinder( BasicValueBinder.Kind.COLLECTION_ELEMENT, buildingContext);
|
||||||
elementBinder.setReturnedClassName( collType.getName() );
|
elementBinder.setReturnedClassName( collType.getName() );
|
||||||
if ( elementColumns == null || elementColumns.length == 0 ) {
|
if ( elementColumns == null || elementColumns.length == 0 ) {
|
||||||
elementColumns = new AnnotatedColumn[1];
|
elementColumns = new AnnotatedColumn[1];
|
||||||
|
|
|
@ -109,8 +109,8 @@ public class IdBagBinder extends BagBinder {
|
||||||
idColumn.setNullable( false );
|
idColumn.setNullable( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
final BasicValueBinder<?> valueBinder =
|
final BasicValueBinder valueBinder =
|
||||||
new BasicValueBinder<>( BasicValueBinder.Kind.COLLECTION_ID, buildingContext );
|
new BasicValueBinder( BasicValueBinder.Kind.COLLECTION_ID, buildingContext );
|
||||||
|
|
||||||
final Table table = collection.getCollectionTable();
|
final Table table = collection.getCollectionTable();
|
||||||
valueBinder.setTable( table );
|
valueBinder.setTable( table );
|
||||||
|
|
|
@ -42,7 +42,9 @@ import org.jboss.logging.Logger;
|
||||||
public class ListBinder extends CollectionBinder {
|
public class ListBinder extends CollectionBinder {
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, ListBinder.class.getName() );
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, ListBinder.class.getName() );
|
||||||
|
|
||||||
public ListBinder(Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver, MetadataBuildingContext buildingContext) {
|
public ListBinder(
|
||||||
|
Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver,
|
||||||
|
MetadataBuildingContext buildingContext) {
|
||||||
super( customTypeBeanResolver, false, buildingContext );
|
super( customTypeBeanResolver, false, buildingContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +114,7 @@ public class ListBinder extends CollectionBinder {
|
||||||
indexColumn.forceNotNull();
|
indexColumn.forceNotNull();
|
||||||
}
|
}
|
||||||
indexColumn.setPropertyHolder( valueHolder );
|
indexColumn.setPropertyHolder( valueHolder );
|
||||||
final BasicValueBinder<?> valueBinder = new BasicValueBinder<>( BasicValueBinder.Kind.LIST_INDEX, buildingContext );
|
final BasicValueBinder valueBinder = new BasicValueBinder( BasicValueBinder.Kind.LIST_INDEX, buildingContext );
|
||||||
valueBinder.setColumns( new AnnotatedColumn[] { indexColumn } );
|
valueBinder.setColumns( new AnnotatedColumn[] { indexColumn } );
|
||||||
valueBinder.setReturnedClassName( Integer.class.getName() );
|
valueBinder.setReturnedClassName( Integer.class.getName() );
|
||||||
valueBinder.setType( property, collType, null, null );
|
valueBinder.setType( property, collType, null, null );
|
||||||
|
|
|
@ -29,7 +29,6 @@ import org.hibernate.cfg.AnnotatedColumn;
|
||||||
import org.hibernate.cfg.AnnotatedJoinColumn;
|
import org.hibernate.cfg.AnnotatedJoinColumn;
|
||||||
import org.hibernate.cfg.InheritanceState;
|
import org.hibernate.cfg.InheritanceState;
|
||||||
import org.hibernate.cfg.PropertyData;
|
import org.hibernate.cfg.PropertyData;
|
||||||
import org.hibernate.cfg.PropertyHolderBuilder;
|
|
||||||
import org.hibernate.cfg.PropertyPreloadedData;
|
import org.hibernate.cfg.PropertyPreloadedData;
|
||||||
import org.hibernate.cfg.SecondPass;
|
import org.hibernate.cfg.SecondPass;
|
||||||
import org.hibernate.engine.jdbc.Size;
|
import org.hibernate.engine.jdbc.Size;
|
||||||
|
@ -60,13 +59,19 @@ import jakarta.persistence.MapKeyColumn;
|
||||||
import jakarta.persistence.MapKeyJoinColumn;
|
import jakarta.persistence.MapKeyJoinColumn;
|
||||||
import jakarta.persistence.MapKeyJoinColumns;
|
import jakarta.persistence.MapKeyJoinColumns;
|
||||||
|
|
||||||
|
import static org.hibernate.cfg.PropertyHolderBuilder.buildPropertyHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation to bind a Map
|
* Implementation to bind a Map
|
||||||
*
|
*
|
||||||
* @author Emmanuel Bernard
|
* @author Emmanuel Bernard
|
||||||
*/
|
*/
|
||||||
public class MapBinder extends CollectionBinder {
|
public class MapBinder extends CollectionBinder {
|
||||||
public MapBinder(Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver, boolean sorted, MetadataBuildingContext buildingContext) {
|
|
||||||
|
public MapBinder(
|
||||||
|
Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver,
|
||||||
|
boolean sorted,
|
||||||
|
MetadataBuildingContext buildingContext) {
|
||||||
super( customTypeBeanResolver, sorted, buildingContext );
|
super( customTypeBeanResolver, sorted, buildingContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -236,7 +241,7 @@ public class MapBinder extends CollectionBinder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectionPropertyHolder holder = PropertyHolderBuilder.buildPropertyHolder(
|
CollectionPropertyHolder holder = buildPropertyHolder(
|
||||||
mapValue,
|
mapValue,
|
||||||
StringHelper.qualify( mapValue.getRole(), "mapkey" ),
|
StringHelper.qualify( mapValue.getRole(), "mapkey" ),
|
||||||
keyXClass,
|
keyXClass,
|
||||||
|
@ -274,14 +279,10 @@ public class MapBinder extends CollectionBinder {
|
||||||
if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
|
if ( AnnotatedClassType.EMBEDDABLE.equals( classType ) ) {
|
||||||
EntityBinder entityBinder = new EntityBinder();
|
EntityBinder entityBinder = new EntityBinder();
|
||||||
|
|
||||||
PropertyData inferredData;
|
PropertyData inferredData = isHibernateExtensionMapping()
|
||||||
if ( isHibernateExtensionMapping() ) {
|
? new PropertyPreloadedData(AccessType.PROPERTY, "index", keyXClass)
|
||||||
inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "index", keyXClass );
|
: new PropertyPreloadedData(AccessType.PROPERTY, "key", keyXClass);
|
||||||
}
|
//"key" is the JPA 2 prefix for map keys
|
||||||
else {
|
|
||||||
//"key" is the JPA 2 prefix for map keys
|
|
||||||
inferredData = new PropertyPreloadedData( AccessType.PROPERTY, "key", keyXClass );
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO be smart with isNullable
|
//TODO be smart with isNullable
|
||||||
Component component = AnnotationBinder.fillComponent(
|
Component component = AnnotationBinder.fillComponent(
|
||||||
|
@ -300,7 +301,7 @@ public class MapBinder extends CollectionBinder {
|
||||||
mapValue.setIndex( component );
|
mapValue.setIndex( component );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final BasicValueBinder<?> elementBinder = new BasicValueBinder<>( BasicValueBinder.Kind.MAP_KEY, buildingContext );
|
final BasicValueBinder elementBinder = new BasicValueBinder( BasicValueBinder.Kind.MAP_KEY, buildingContext );
|
||||||
elementBinder.setReturnedClassName( mapKeyType );
|
elementBinder.setReturnedClassName( mapKeyType );
|
||||||
|
|
||||||
AnnotatedColumn[] elementColumns = mapKeyColumns;
|
AnnotatedColumn[] elementColumns = mapKeyColumns;
|
||||||
|
@ -347,7 +348,8 @@ public class MapBinder extends CollectionBinder {
|
||||||
final jakarta.persistence.ForeignKey foreignKey = getMapKeyForeignKey( property );
|
final jakarta.persistence.ForeignKey foreignKey = getMapKeyForeignKey( property );
|
||||||
if ( foreignKey != null ) {
|
if ( foreignKey != null ) {
|
||||||
if ( foreignKey.value() == ConstraintMode.NO_CONSTRAINT
|
if ( foreignKey.value() == ConstraintMode.NO_CONSTRAINT
|
||||||
|| foreignKey.value() == ConstraintMode.PROVIDER_DEFAULT && getBuildingContext().getBuildingOptions().isNoConstraintByDefault() ) {
|
|| foreignKey.value() == ConstraintMode.PROVIDER_DEFAULT
|
||||||
|
&& getBuildingContext().getBuildingOptions().isNoConstraintByDefault() ) {
|
||||||
element.disableForeignKey();
|
element.disableForeignKey();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -440,7 +442,12 @@ public class MapBinder extends CollectionBinder {
|
||||||
newProperty.setSelectable( current.isSelectable() );
|
newProperty.setSelectable( current.isSelectable() );
|
||||||
newProperty.setValue(
|
newProperty.setValue(
|
||||||
createFormulatedValue(
|
createFormulatedValue(
|
||||||
current.getValue(), collection, targetPropertyName, associatedClass, associatedClass, buildingContext
|
current.getValue(),
|
||||||
|
collection,
|
||||||
|
targetPropertyName,
|
||||||
|
associatedClass,
|
||||||
|
associatedClass,
|
||||||
|
buildingContext
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
indexComponent.addProperty( newProperty );
|
indexComponent.addProperty( newProperty );
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class PropertyBinder {
|
||||||
private boolean insertable = true;
|
private boolean insertable = true;
|
||||||
private boolean updatable = true;
|
private boolean updatable = true;
|
||||||
private String cascade;
|
private String cascade;
|
||||||
private BasicValueBinder<?> basicValueBinder;
|
private BasicValueBinder basicValueBinder;
|
||||||
private XClass declaringClass;
|
private XClass declaringClass;
|
||||||
private boolean declaringClassSet;
|
private boolean declaringClassSet;
|
||||||
private boolean embedded;
|
private boolean embedded;
|
||||||
|
@ -179,7 +179,7 @@ public class PropertyBinder {
|
||||||
final String containerClassName = holder.getClassName();
|
final String containerClassName = holder.getClassName();
|
||||||
holder.startingProperty( property );
|
holder.startingProperty( property );
|
||||||
|
|
||||||
basicValueBinder = new BasicValueBinder<>( BasicValueBinder.Kind.ATTRIBUTE, buildingContext );
|
basicValueBinder = new BasicValueBinder( BasicValueBinder.Kind.ATTRIBUTE, buildingContext );
|
||||||
basicValueBinder.setPropertyName( name );
|
basicValueBinder.setPropertyName( name );
|
||||||
basicValueBinder.setReturnedClassName( returnedClassName );
|
basicValueBinder.setReturnedClassName( returnedClassName );
|
||||||
basicValueBinder.setColumns( columns );
|
basicValueBinder.setColumns( columns );
|
||||||
|
@ -525,7 +525,7 @@ public class PropertyBinder {
|
||||||
this.returnedClass = returnedClass;
|
this.returnedClass = returnedClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BasicValueBinder<?> getBasicValueBinder() {
|
public BasicValueBinder getBasicValueBinder() {
|
||||||
return basicValueBinder;
|
return basicValueBinder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,11 @@ import org.hibernate.usertype.UserCollectionType;
|
||||||
* @author Matthew Inger
|
* @author Matthew Inger
|
||||||
*/
|
*/
|
||||||
public class SetBinder extends CollectionBinder {
|
public class SetBinder extends CollectionBinder {
|
||||||
public SetBinder(Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver, boolean sorted, MetadataBuildingContext buildingContext) {
|
|
||||||
|
public SetBinder(
|
||||||
|
Supplier<ManagedBean<? extends UserCollectionType>> customTypeBeanResolver,
|
||||||
|
boolean sorted,
|
||||||
|
MetadataBuildingContext buildingContext) {
|
||||||
super( customTypeBeanResolver, sorted, buildingContext );
|
super( customTypeBeanResolver, sorted, buildingContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue