diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java b/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java index 16abb15d66..86a03fbeb8 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java @@ -612,10 +612,20 @@ public abstract class Collection implements Fetchable, Value, Filterable { this.elementNodeName = elementNodeName; } + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ + @Deprecated public boolean isEmbedded() { return embedded; } + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ + @Deprecated public void setEmbedded(boolean embedded) { this.embedded = embedded; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/OneToMany.java b/hibernate-core/src/main/java/org/hibernate/mapping/OneToMany.java index 8b14cfb616..3322e2ad34 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/OneToMany.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/OneToMany.java @@ -150,11 +150,21 @@ public class OneToMany implements Value { //TODO: we could just return all false... throw new UnsupportedOperationException(); } - + + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ + @Deprecated public boolean isEmbedded() { return embedded; } - + + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ + @Deprecated public void setEmbedded(boolean embedded) { this.embedded = embedded; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/ToOne.java b/hibernate-core/src/main/java/org/hibernate/mapping/ToOne.java index a33fb7355d..9a6ab734f8 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/ToOne.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/ToOne.java @@ -88,11 +88,21 @@ public abstract class ToOne extends SimpleValue implements Fetchable { public Object accept(ValueVisitor visitor) { return visitor.accept(this); } - + + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ + @Deprecated public boolean isEmbedded() { return embedded; } - + + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ + @Deprecated public void setEmbedded(boolean embedded) { this.embedded = embedded; } diff --git a/hibernate-core/src/main/java/org/hibernate/type/ArrayType.java b/hibernate-core/src/main/java/org/hibernate/type/ArrayType.java index 0c2aef0ab5..893518f3c4 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ArrayType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ArrayType.java @@ -47,12 +47,23 @@ public class ArrayType extends CollectionType { private final Class elementClass; private final Class arrayClass; + /** + * @deprecated Use {@link #ArrayType(TypeFactory.TypeScope, String, String, Class )} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public ArrayType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); this.elementClass = elementClass; arrayClass = Array.newInstance(elementClass, 0).getClass(); } + public ArrayType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Class elementClass) { + super( typeScope, role, propertyRef ); + this.elementClass = elementClass; + arrayClass = Array.newInstance(elementClass, 0).getClass(); + } + public Class getReturnedClass() { return arrayClass; } diff --git a/hibernate-core/src/main/java/org/hibernate/type/AssociationType.java b/hibernate-core/src/main/java/org/hibernate/type/AssociationType.java index de865bbea7..88ed066c4b 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/AssociationType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/AssociationType.java @@ -85,7 +85,12 @@ public interface AssociationType extends Type { * no columns to be updated? */ public abstract boolean isAlwaysDirtyChecked(); - + + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ + @Deprecated public boolean isEmbeddedInXML(); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/BagType.java b/hibernate-core/src/main/java/org/hibernate/type/BagType.java index 969aa96dd1..08f7ad2a15 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/BagType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/BagType.java @@ -35,10 +35,19 @@ import org.hibernate.persister.collection.CollectionPersister; public class BagType extends CollectionType { + /** + * @deprecated Use {@link #BagType(TypeFactory.TypeScope, String, String )} + * See Jira issue: HHH-7771 + */ + @Deprecated public BagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); } + public BagType(TypeFactory.TypeScope typeScope, String role, String propertyRef) { + super( typeScope, role, propertyRef ); + } + public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) throws HibernateException { return new PersistentBag(session); diff --git a/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java b/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java index d119badddf..4950059ea2 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/CollectionType.java @@ -81,6 +81,11 @@ public abstract class CollectionType extends AbstractType implements Association private final String foreignKeyPropertyName; private final boolean isEmbeddedInXML; + /** + * @deprecated Use {@link #CollectionType(TypeFactory.TypeScope, String, String)} instead + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) { this.typeScope = typeScope; this.role = role; @@ -88,6 +93,13 @@ public abstract class CollectionType extends AbstractType implements Association this.isEmbeddedInXML = isEmbeddedInXML; } + public CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName) { + this.typeScope = typeScope; + this.role = role; + this.foreignKeyPropertyName = foreignKeyPropertyName; + this.isEmbeddedInXML = true; + } + public boolean isEmbeddedInXML() { return isEmbeddedInXML; } diff --git a/hibernate-core/src/main/java/org/hibernate/type/CustomCollectionType.java b/hibernate-core/src/main/java/org/hibernate/type/CustomCollectionType.java index d2cff37443..e0531c4145 100755 --- a/hibernate-core/src/main/java/org/hibernate/type/CustomCollectionType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/CustomCollectionType.java @@ -48,6 +48,11 @@ public class CustomCollectionType extends CollectionType { private final UserCollectionType userType; private final boolean customLogging; + /** + * @deprecated Use {@link #CustomCollectionType(TypeFactory.TypeScope, Class, String, String )} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CustomCollectionType( TypeFactory.TypeScope typeScope, Class userTypeClass, @@ -55,13 +60,27 @@ public class CustomCollectionType extends CollectionType { String foreignKeyPropertyName, boolean isEmbeddedInXML) { super( typeScope, role, foreignKeyPropertyName, isEmbeddedInXML ); + userType = createUserCollectionType( userTypeClass ); + customLogging = LoggableUserType.class.isAssignableFrom( userTypeClass ); + } + public CustomCollectionType( + TypeFactory.TypeScope typeScope, + Class userTypeClass, + String role, + String foreignKeyPropertyName) { + super( typeScope, role, foreignKeyPropertyName ); + userType = createUserCollectionType( userTypeClass ); + customLogging = LoggableUserType.class.isAssignableFrom( userTypeClass ); + } + + private static UserCollectionType createUserCollectionType(Class userTypeClass) { if ( !UserCollectionType.class.isAssignableFrom( userTypeClass ) ) { throw new MappingException( "Custom type does not implement UserCollectionType: " + userTypeClass.getName() ); } try { - userType = ( UserCollectionType ) userTypeClass.newInstance(); + return ( UserCollectionType ) userTypeClass.newInstance(); } catch ( InstantiationException ie ) { throw new MappingException( "Cannot instantiate custom type: " + userTypeClass.getName() ); @@ -69,8 +88,6 @@ public class CustomCollectionType extends CollectionType { catch ( IllegalAccessException iae ) { throw new MappingException( "IllegalAccessException trying to instantiate custom type: " + userTypeClass.getName() ); } - - customLogging = LoggableUserType.class.isAssignableFrom( userTypeClass ); } public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) diff --git a/hibernate-core/src/main/java/org/hibernate/type/EntityType.java b/hibernate-core/src/main/java/org/hibernate/type/EntityType.java index 9265c31a2f..0451e09dcc 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/EntityType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/EntityType.java @@ -76,7 +76,11 @@ public abstract class EntityType extends AbstractType implements AssociationType * @param unwrapProxy Is unwrapping of proxies allowed for this association; unwrapping * says to return the "implementation target" of lazy prooxies; typically only possible * with lazy="no-proxy". + * + * @deprecated Use {@link #EntityType(TypeFactory.TypeScope, String, String, boolean, boolean )} instead. + * See Jira issue: HHH-7771 */ + @Deprecated protected EntityType( TypeFactory.TypeScope scope, String entityName, @@ -92,6 +96,32 @@ public abstract class EntityType extends AbstractType implements AssociationType this.unwrapProxy = unwrapProxy; } + /** + * Constructs the requested entity type mapping. + * + * @param scope The type scope + * @param entityName The name of the associated entity. + * @param uniqueKeyPropertyName The property-ref name, or null if we + * reference the PK of the associated entity. + * @param eager Is eager fetching enabled. + * @param unwrapProxy Is unwrapping of proxies allowed for this association; unwrapping + * says to return the "implementation target" of lazy prooxies; typically only possible + * with lazy="no-proxy". + */ + protected EntityType( + TypeFactory.TypeScope scope, + String entityName, + String uniqueKeyPropertyName, + boolean eager, + boolean unwrapProxy) { + this.scope = scope; + this.associatedEntityName = entityName; + this.uniqueKeyPropertyName = uniqueKeyPropertyName; + this.isEmbeddedInXML = true; + this.eager = eager; + this.unwrapProxy = unwrapProxy; + } + protected TypeFactory.TypeScope scope() { return scope; } @@ -476,6 +506,11 @@ public abstract class EntityType extends AbstractType implements AssociationType } } + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ + @Deprecated protected boolean isNotEmbedded(SessionImplementor session) { // return !isEmbeddedInXML; return false; diff --git a/hibernate-core/src/main/java/org/hibernate/type/IdentifierBagType.java b/hibernate-core/src/main/java/org/hibernate/type/IdentifierBagType.java index 306a815884..2d34237b95 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/IdentifierBagType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/IdentifierBagType.java @@ -34,10 +34,19 @@ import org.hibernate.persister.collection.CollectionPersister; public class IdentifierBagType extends CollectionType { + /** + * @deprecated Use {@link #IdentifierBagType(org.hibernate.type.TypeFactory.TypeScope, String, String)} + * See Jira issue: HHH-7771 + */ + @Deprecated public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); } + public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef) { + super( typeScope, role, propertyRef ); + } + public PersistentCollection instantiate( SessionImplementor session, CollectionPersister persister, Serializable key) diff --git a/hibernate-core/src/main/java/org/hibernate/type/ListType.java b/hibernate-core/src/main/java/org/hibernate/type/ListType.java index fd825d9727..b7d9824b4c 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ListType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ListType.java @@ -34,10 +34,19 @@ import org.hibernate.persister.collection.CollectionPersister; public class ListType extends CollectionType { + /** + * @deprecated Use {@link #ListType(org.hibernate.type.TypeFactory.TypeScope, String, String)} + * See Jira issue: HHH-7771 + */ + @Deprecated public ListType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); } + public ListType(TypeFactory.TypeScope typeScope, String role, String propertyRef) { + super( typeScope, role, propertyRef ); + } + public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) { return new PersistentList(session); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/ManyToOneType.java b/hibernate-core/src/main/java/org/hibernate/type/ManyToOneType.java index 446dbf3467..c7cd51db99 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ManyToOneType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ManyToOneType.java @@ -70,6 +70,12 @@ public class ManyToOneType extends EntityType { this( scope, referencedEntityName, null, lazy, true, false, false, false ); } + + /** + * @deprecated Use {@link #ManyToOneType(TypeFactory.TypeScope, String, String, boolean, boolean, boolean, boolean ) } instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public ManyToOneType( TypeFactory.TypeScope scope, String referencedEntityName, @@ -84,6 +90,19 @@ public class ManyToOneType extends EntityType { this.isLogicalOneToOne = isLogicalOneToOne; } + public ManyToOneType( + TypeFactory.TypeScope scope, + String referencedEntityName, + String uniqueKeyPropertyName, + boolean lazy, + boolean unwrapProxy, + boolean ignoreNotFound, + boolean isLogicalOneToOne) { + super( scope, referencedEntityName, uniqueKeyPropertyName, !lazy, unwrapProxy ); + this.ignoreNotFound = ignoreNotFound; + this.isLogicalOneToOne = isLogicalOneToOne; + } + protected boolean isNullable() { return ignoreNotFound; } diff --git a/hibernate-core/src/main/java/org/hibernate/type/MapType.java b/hibernate-core/src/main/java/org/hibernate/type/MapType.java index 38a737b23d..f0aa1d1447 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/MapType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/MapType.java @@ -37,10 +37,19 @@ import org.hibernate.persister.collection.CollectionPersister; public class MapType extends CollectionType { + /** + * @deprecated Use {@link #MapType(TypeFactory.TypeScope, String, String ) } instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public MapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); } + public MapType(TypeFactory.TypeScope typeScope, String role, String propertyRef) { + super( typeScope, role, propertyRef ); + } + public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) { return new PersistentMap(session); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/OneToOneType.java b/hibernate-core/src/main/java/org/hibernate/type/OneToOneType.java index ccf543cae3..838955bf72 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/OneToOneType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/OneToOneType.java @@ -47,6 +47,12 @@ public class OneToOneType extends EntityType { private final String propertyName; private final String entityName; + /** + * @deprecated Use {@link #OneToOneType(TypeFactory.TypeScope, String, ForeignKeyDirection, String, boolean, boolean, String, String)} + * instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public OneToOneType( TypeFactory.TypeScope scope, String referencedEntityName, @@ -62,7 +68,22 @@ public class OneToOneType extends EntityType { this.propertyName = propertyName; this.entityName = entityName; } - + + public OneToOneType( + TypeFactory.TypeScope scope, + String referencedEntityName, + ForeignKeyDirection foreignKeyType, + String uniqueKeyPropertyName, + boolean lazy, + boolean unwrapProxy, + String entityName, + String propertyName) { + super( scope, referencedEntityName, uniqueKeyPropertyName, !lazy, unwrapProxy ); + this.foreignKeyType = foreignKeyType; + this.propertyName = propertyName; + this.entityName = entityName; + } + public String getPropertyName() { return propertyName; } diff --git a/hibernate-core/src/main/java/org/hibernate/type/OrderedMapType.java b/hibernate-core/src/main/java/org/hibernate/type/OrderedMapType.java index 708be71586..b00b1eaf4b 100755 --- a/hibernate-core/src/main/java/org/hibernate/type/OrderedMapType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/OrderedMapType.java @@ -36,11 +36,20 @@ public class OrderedMapType extends MapType { * @param role The collection role name. * @param propertyRef The property ref name. * @param isEmbeddedInXML Is this collection to embed itself in xml + * + * @deprecated Use {@link #OrderedMapType(TypeFactory.TypeScope, String, String)} instead. + * instead. + * See Jira issue: HHH-7771 */ + @Deprecated public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); } + public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef) { + super( typeScope, role, propertyRef ); + } + /** * {@inheritDoc} */ diff --git a/hibernate-core/src/main/java/org/hibernate/type/OrderedSetType.java b/hibernate-core/src/main/java/org/hibernate/type/OrderedSetType.java index 970b01821e..b9aae70074 100755 --- a/hibernate-core/src/main/java/org/hibernate/type/OrderedSetType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/OrderedSetType.java @@ -37,11 +37,20 @@ public class OrderedSetType extends SetType { * @param role The collection role name. * @param propertyRef The property ref name. * @param isEmbeddedInXML Is this collection to embed itself in xml + * + * @deprecated Use {@link #OrderedSetType(org.hibernate.type.TypeFactory.TypeScope, String, String)} + * instead. + * See Jira issue: HHH-7771 */ + @Deprecated public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); } + public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef) { + super( typeScope, role, propertyRef ); + } + /** * {@inheritDoc} */ diff --git a/hibernate-core/src/main/java/org/hibernate/type/SetType.java b/hibernate-core/src/main/java/org/hibernate/type/SetType.java index 52b03dbd70..e1b6bd3242 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/SetType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/SetType.java @@ -33,10 +33,19 @@ import org.hibernate.persister.collection.CollectionPersister; public class SetType extends CollectionType { + /** + * @deprecated Use {@link #SetType(org.hibernate.type.TypeFactory.TypeScope, String, String)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); } + public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef) { + super( typeScope, role, propertyRef ); + } + public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) { return new PersistentSet(session); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/SortedMapType.java b/hibernate-core/src/main/java/org/hibernate/type/SortedMapType.java index 172bcb2fd0..1087ea0add 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/SortedMapType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/SortedMapType.java @@ -37,11 +37,22 @@ public class SortedMapType extends MapType { private final Comparator comparator; + /** + * @deprecated Use {@link #SortedMapType(org.hibernate.type.TypeFactory.TypeScope, String, String, java.util.Comparator)} + * instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public SortedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); this.comparator = comparator; } + public SortedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator) { + super( typeScope, role, propertyRef ); + this.comparator = comparator; + } + public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) { PersistentSortedMap map = new PersistentSortedMap(session); map.setComparator(comparator); diff --git a/hibernate-core/src/main/java/org/hibernate/type/SortedSetType.java b/hibernate-core/src/main/java/org/hibernate/type/SortedSetType.java index 8e78e05436..eeb6ff48bd 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/SortedSetType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/SortedSetType.java @@ -35,11 +35,22 @@ import org.hibernate.persister.collection.CollectionPersister; public class SortedSetType extends SetType { private final Comparator comparator; + /** + * @deprecated Use {@link #SortedSetType(org.hibernate.type.TypeFactory.TypeScope, String, String, java.util.Comparator)} + * instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public SortedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) { super( typeScope, role, propertyRef, isEmbeddedInXML ); this.comparator = comparator; } + public SortedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator) { + super( typeScope, role, propertyRef ); + this.comparator = comparator; + } + public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) { PersistentSortedSet set = new PersistentSortedSet(session); set.setComparator(comparator); diff --git a/hibernate-core/src/main/java/org/hibernate/type/Type.java b/hibernate-core/src/main/java/org/hibernate/type/Type.java index d2b3aa058d..3a75ac8b78 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/Type.java +++ b/hibernate-core/src/main/java/org/hibernate/type/Type.java @@ -166,8 +166,13 @@ public interface Type extends Serializable { * @return The java type class handled by this type. */ public Class getReturnedClass(); - + + /** + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 + */ @SuppressWarnings( {"UnusedDeclaration"}) + @Deprecated public boolean isXMLElement(); /** @@ -392,7 +397,11 @@ public interface Type extends Serializable { * @param factory The session factory * * @throws HibernateException An error from Hibernate + * + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 */ + @Deprecated public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException; @@ -405,7 +414,11 @@ public interface Type extends Serializable { * @return an instance of the {@link #getReturnedClass() mapped class} * * @throws HibernateException An error from Hibernate + * + * @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode. + * See Jira issue: HHH-7771 */ + @Deprecated public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException; /** diff --git a/hibernate-core/src/main/java/org/hibernate/type/TypeFactory.java b/hibernate-core/src/main/java/org/hibernate/type/TypeFactory.java index 5086bd846e..131251349c 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/TypeFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/type/TypeFactory.java @@ -155,6 +155,12 @@ public final class TypeFactory implements Serializable { } } + /** + * @deprecated Use {@link #customCollection(String, java.util.Properties, String, String)} + * instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType customCollection( String typeName, Properties typeParameters, @@ -175,6 +181,25 @@ public final class TypeFactory implements Serializable { return result; } + public CollectionType customCollection( + String typeName, + Properties typeParameters, + String role, + String propertyRef) { + Class typeClass; + try { + typeClass = ReflectHelper.classForName( typeName ); + } + catch ( ClassNotFoundException cnfe ) { + throw new MappingException( "user collection type class not found: " + typeName, cnfe ); + } + CustomCollectionType result = new CustomCollectionType( typeScope, typeClass, role, propertyRef ); + if ( typeParameters != null ) { + injectParameters( result.getUserType(), typeParameters ); + } + return result; + } + public CustomType custom(Class typeClass, Properties parameters) { return custom( typeClass, parameters, typeScope ); } @@ -209,6 +234,12 @@ public final class TypeFactory implements Serializable { // one-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** + * @deprecated Use {@link #oneToOne(String, ForeignKeyDirection, String, boolean, boolean, String, String)} + * instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public EntityType oneToOne( String persistentClass, ForeignKeyDirection foreignKeyType, @@ -222,6 +253,18 @@ public final class TypeFactory implements Serializable { lazy, unwrapProxy, isEmbeddedInXML, entityName, propertyName ); } + public EntityType oneToOne( + String persistentClass, + ForeignKeyDirection foreignKeyType, + String uniqueKeyPropertyName, + boolean lazy, + boolean unwrapProxy, + String entityName, + String propertyName) { + return new OneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName, + lazy, unwrapProxy, entityName, propertyName ); + } + public EntityType specialOneToOne( String persistentClass, ForeignKeyDirection foreignKeyType, @@ -245,6 +288,12 @@ public final class TypeFactory implements Serializable { return new ManyToOneType( typeScope, persistentClass, lazy ); } + /** + * @deprecated Use {@link #manyToOne(String, String, boolean, boolean, boolean, boolean)} + * instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public EntityType manyToOne( String persistentClass, String uniqueKeyPropertyName, @@ -265,49 +314,155 @@ public final class TypeFactory implements Serializable { ); } + public EntityType manyToOne( + String persistentClass, + String uniqueKeyPropertyName, + boolean lazy, + boolean unwrapProxy, + boolean ignoreNotFound, + boolean isLogicalOneToOne) { + return new ManyToOneType( + typeScope, + persistentClass, + uniqueKeyPropertyName, + lazy, + unwrapProxy, + ignoreNotFound, + isLogicalOneToOne + ); + } // collection type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /** + * @deprecated Use {@link #array(String, String, Class)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType array(String role, String propertyRef, boolean embedded, Class elementClass) { return new ArrayType( typeScope, role, propertyRef, elementClass, embedded ); } + public CollectionType array(String role, String propertyRef, Class elementClass) { + return new ArrayType( typeScope, role, propertyRef, elementClass ); + } + + /** + * @deprecated Use {@link #list(String, String)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType list(String role, String propertyRef, boolean embedded) { return new ListType( typeScope, role, propertyRef, embedded ); } + public CollectionType list(String role, String propertyRef) { + return new ListType( typeScope, role, propertyRef ); + } + + /** + * @deprecated Use {@link #bag(String, String)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType bag(String role, String propertyRef, boolean embedded) { return new BagType( typeScope, role, propertyRef, embedded ); } + public CollectionType bag(String role, String propertyRef) { + return new BagType( typeScope, role, propertyRef ); + } + + /** + * @deprecated Use {@link #idbag(String, String)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType idbag(String role, String propertyRef, boolean embedded) { return new IdentifierBagType( typeScope, role, propertyRef, embedded ); } + public CollectionType idbag(String role, String propertyRef) { + return new IdentifierBagType( typeScope, role, propertyRef ); + } + + /** + * @deprecated Use {@link #map(String, String)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType map(String role, String propertyRef, boolean embedded) { return new MapType( typeScope, role, propertyRef, embedded ); } + public CollectionType map(String role, String propertyRef) { + return new MapType( typeScope, role, propertyRef ); + } + + /** + * @deprecated Use {@link #orderedMap(String, String)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType orderedMap(String role, String propertyRef, boolean embedded) { return new OrderedMapType( typeScope, role, propertyRef, embedded ); } + public CollectionType orderedMap(String role, String propertyRef) { + return new OrderedMapType( typeScope, role, propertyRef ); + } + + /** + * @deprecated Use {@link #sortedMap(String, String, java.util.Comparator)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType sortedMap(String role, String propertyRef, boolean embedded, Comparator comparator) { return new SortedMapType( typeScope, role, propertyRef, comparator, embedded ); } + public CollectionType sortedMap(String role, String propertyRef, Comparator comparator) { + return new SortedMapType( typeScope, role, propertyRef, comparator ); + } + + /** + * @deprecated Use {@link #set(String, String)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType set(String role, String propertyRef, boolean embedded) { return new SetType( typeScope, role, propertyRef, embedded ); } + public CollectionType set(String role, String propertyRef) { + return new SetType( typeScope, role, propertyRef ); + } + + /** + * @deprecated Use {@link #orderedSet(String, String)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType orderedSet(String role, String propertyRef, boolean embedded) { return new OrderedSetType( typeScope, role, propertyRef, embedded ); } + public CollectionType orderedSet(String role, String propertyRef) { + return new OrderedSetType( typeScope, role, propertyRef ); + } + + /** + * @deprecated Use {@link #sortedSet(String, String, java.util.Comparator)} instead. + * See Jira issue: HHH-7771 + */ + @Deprecated public CollectionType sortedSet(String role, String propertyRef, boolean embedded, Comparator comparator) { return new SortedSetType( typeScope, role, propertyRef, comparator, embedded ); } + public CollectionType sortedSet(String role, String propertyRef, Comparator comparator) { + return new SortedSetType( typeScope, role, propertyRef, comparator ); + } // component type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~