HHH-7771 : Deprecate obsolete Type, AssociationType, and TypeFactory methods

This commit is contained in:
Gail Badner 2012-12-12 02:29:23 -08:00 committed by Strong Liu
parent c6ef23a51c
commit 005cc6cd2a
21 changed files with 413 additions and 10 deletions

View File

@ -612,10 +612,20 @@ public abstract class Collection implements Fetchable, Value, Filterable {
this.elementNodeName = elementNodeName; this.elementNodeName = elementNodeName;
} }
/**
* @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public boolean isEmbedded() { public boolean isEmbedded() {
return embedded; return embedded;
} }
/**
* @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public void setEmbedded(boolean embedded) { public void setEmbedded(boolean embedded) {
this.embedded = embedded; this.embedded = embedded;
} }

View File

@ -151,10 +151,20 @@ public class OneToMany implements Value {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
/**
* @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public boolean isEmbedded() { public boolean isEmbedded() {
return embedded; return embedded;
} }
/**
* @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public void setEmbedded(boolean embedded) { public void setEmbedded(boolean embedded) {
this.embedded = embedded; this.embedded = embedded;
} }

View File

@ -89,10 +89,20 @@ public abstract class ToOne extends SimpleValue implements Fetchable {
return visitor.accept(this); return visitor.accept(this);
} }
/**
* @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public boolean isEmbedded() { public boolean isEmbedded() {
return embedded; return embedded;
} }
/**
* @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public void setEmbedded(boolean embedded) { public void setEmbedded(boolean embedded) {
this.embedded = embedded; this.embedded = embedded;
} }

View File

@ -47,12 +47,23 @@ public class ArrayType extends CollectionType {
private final Class elementClass; private final Class elementClass;
private final Class arrayClass; private final Class arrayClass;
/**
* @deprecated Use {@link #ArrayType(TypeFactory.TypeScope, String, String, Class )} instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public ArrayType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) { public ArrayType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, isEmbeddedInXML ); super( typeScope, role, propertyRef, isEmbeddedInXML );
this.elementClass = elementClass; this.elementClass = elementClass;
arrayClass = Array.newInstance(elementClass, 0).getClass(); 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() { public Class getReturnedClass() {
return arrayClass; return arrayClass;
} }

View File

@ -86,6 +86,11 @@ public interface AssociationType extends Type {
*/ */
public abstract boolean isAlwaysDirtyChecked(); public abstract boolean isAlwaysDirtyChecked();
/**
* @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public boolean isEmbeddedInXML(); public boolean isEmbeddedInXML();
} }

View File

@ -35,10 +35,19 @@ import org.hibernate.persister.collection.CollectionPersister;
public class BagType extends CollectionType { public class BagType extends CollectionType {
/**
* @deprecated Use {@link #BagType(TypeFactory.TypeScope, String, String )}
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public BagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { public BagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, 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) public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key)
throws HibernateException { throws HibernateException {
return new PersistentBag(session); return new PersistentBag(session);

View File

@ -81,6 +81,11 @@ public abstract class CollectionType extends AbstractType implements Association
private final String foreignKeyPropertyName; private final String foreignKeyPropertyName;
private final boolean isEmbeddedInXML; private final boolean isEmbeddedInXML;
/**
* @deprecated Use {@link #CollectionType(TypeFactory.TypeScope, String, String)} instead
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) { public CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
this.typeScope = typeScope; this.typeScope = typeScope;
this.role = role; this.role = role;
@ -88,6 +93,13 @@ public abstract class CollectionType extends AbstractType implements Association
this.isEmbeddedInXML = isEmbeddedInXML; 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() { public boolean isEmbeddedInXML() {
return isEmbeddedInXML; return isEmbeddedInXML;
} }

View File

@ -48,6 +48,11 @@ public class CustomCollectionType extends CollectionType {
private final UserCollectionType userType; private final UserCollectionType userType;
private final boolean customLogging; private final boolean customLogging;
/**
* @deprecated Use {@link #CustomCollectionType(TypeFactory.TypeScope, Class, String, String )} instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CustomCollectionType( public CustomCollectionType(
TypeFactory.TypeScope typeScope, TypeFactory.TypeScope typeScope,
Class userTypeClass, Class userTypeClass,
@ -55,13 +60,27 @@ public class CustomCollectionType extends CollectionType {
String foreignKeyPropertyName, String foreignKeyPropertyName,
boolean isEmbeddedInXML) { boolean isEmbeddedInXML) {
super( typeScope, role, foreignKeyPropertyName, 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 ) ) { if ( !UserCollectionType.class.isAssignableFrom( userTypeClass ) ) {
throw new MappingException( "Custom type does not implement UserCollectionType: " + userTypeClass.getName() ); throw new MappingException( "Custom type does not implement UserCollectionType: " + userTypeClass.getName() );
} }
try { try {
userType = ( UserCollectionType ) userTypeClass.newInstance(); return ( UserCollectionType ) userTypeClass.newInstance();
} }
catch ( InstantiationException ie ) { catch ( InstantiationException ie ) {
throw new MappingException( "Cannot instantiate custom type: " + userTypeClass.getName() ); throw new MappingException( "Cannot instantiate custom type: " + userTypeClass.getName() );
@ -69,8 +88,6 @@ public class CustomCollectionType extends CollectionType {
catch ( IllegalAccessException iae ) { catch ( IllegalAccessException iae ) {
throw new MappingException( "IllegalAccessException trying to instantiate custom type: " + userTypeClass.getName() ); 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) public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key)

View File

@ -76,7 +76,11 @@ public abstract class EntityType extends AbstractType implements AssociationType
* @param unwrapProxy Is unwrapping of proxies allowed for this association; unwrapping * @param unwrapProxy Is unwrapping of proxies allowed for this association; unwrapping
* says to return the "implementation target" of lazy prooxies; typically only possible * says to return the "implementation target" of lazy prooxies; typically only possible
* with lazy="no-proxy". * with lazy="no-proxy".
*
* @deprecated Use {@link #EntityType(TypeFactory.TypeScope, String, String, boolean, boolean )} instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/ */
@Deprecated
protected EntityType( protected EntityType(
TypeFactory.TypeScope scope, TypeFactory.TypeScope scope,
String entityName, String entityName,
@ -92,6 +96,32 @@ public abstract class EntityType extends AbstractType implements AssociationType
this.unwrapProxy = unwrapProxy; 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() { protected TypeFactory.TypeScope scope() {
return 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
protected boolean isNotEmbedded(SessionImplementor session) { protected boolean isNotEmbedded(SessionImplementor session) {
// return !isEmbeddedInXML; // return !isEmbeddedInXML;
return false; return false;

View File

@ -34,10 +34,19 @@ import org.hibernate.persister.collection.CollectionPersister;
public class IdentifierBagType extends CollectionType { public class IdentifierBagType extends CollectionType {
/**
* @deprecated Use {@link #IdentifierBagType(org.hibernate.type.TypeFactory.TypeScope, String, String)}
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, isEmbeddedInXML ); super( typeScope, role, propertyRef, isEmbeddedInXML );
} }
public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
}
public PersistentCollection instantiate( public PersistentCollection instantiate(
SessionImplementor session, SessionImplementor session,
CollectionPersister persister, Serializable key) CollectionPersister persister, Serializable key)

View File

@ -34,10 +34,19 @@ import org.hibernate.persister.collection.CollectionPersister;
public class ListType extends CollectionType { public class ListType extends CollectionType {
/**
* @deprecated Use {@link #ListType(org.hibernate.type.TypeFactory.TypeScope, String, String)}
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public ListType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { public ListType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, 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) { public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
return new PersistentList(session); return new PersistentList(session);
} }

View File

@ -70,6 +70,12 @@ public class ManyToOneType extends EntityType {
this( scope, referencedEntityName, null, lazy, true, false, false, false ); 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public ManyToOneType( public ManyToOneType(
TypeFactory.TypeScope scope, TypeFactory.TypeScope scope,
String referencedEntityName, String referencedEntityName,
@ -84,6 +90,19 @@ public class ManyToOneType extends EntityType {
this.isLogicalOneToOne = isLogicalOneToOne; 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() { protected boolean isNullable() {
return ignoreNotFound; return ignoreNotFound;
} }

View File

@ -37,10 +37,19 @@ import org.hibernate.persister.collection.CollectionPersister;
public class MapType extends CollectionType { public class MapType extends CollectionType {
/**
* @deprecated Use {@link #MapType(TypeFactory.TypeScope, String, String ) } instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public MapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { public MapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, 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) { public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
return new PersistentMap(session); return new PersistentMap(session);
} }

View File

@ -47,6 +47,12 @@ public class OneToOneType extends EntityType {
private final String propertyName; private final String propertyName;
private final String entityName; private final String entityName;
/**
* @deprecated Use {@link #OneToOneType(TypeFactory.TypeScope, String, ForeignKeyDirection, String, boolean, boolean, String, String)}
* instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public OneToOneType( public OneToOneType(
TypeFactory.TypeScope scope, TypeFactory.TypeScope scope,
String referencedEntityName, String referencedEntityName,
@ -63,6 +69,21 @@ public class OneToOneType extends EntityType {
this.entityName = entityName; 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() { public String getPropertyName() {
return propertyName; return propertyName;
} }

View File

@ -36,11 +36,20 @@ public class OrderedMapType extends MapType {
* @param role The collection role name. * @param role The collection role name.
* @param propertyRef The property ref name. * @param propertyRef The property ref name.
* @param isEmbeddedInXML Is this collection to embed itself in xml * @param isEmbeddedInXML Is this collection to embed itself in xml
*
* @deprecated Use {@link #OrderedMapType(TypeFactory.TypeScope, String, String)} instead.
* instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/ */
@Deprecated
public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, isEmbeddedInXML ); super( typeScope, role, propertyRef, isEmbeddedInXML );
} }
public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -37,11 +37,20 @@ public class OrderedSetType extends SetType {
* @param role The collection role name. * @param role The collection role name.
* @param propertyRef The property ref name. * @param propertyRef The property ref name.
* @param isEmbeddedInXML Is this collection to embed itself in xml * @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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/ */
@Deprecated
public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, isEmbeddedInXML ); super( typeScope, role, propertyRef, isEmbeddedInXML );
} }
public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef) {
super( typeScope, role, propertyRef );
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -33,10 +33,19 @@ import org.hibernate.persister.collection.CollectionPersister;
public class SetType extends CollectionType { public class SetType extends CollectionType {
/**
* @deprecated Use {@link #SetType(org.hibernate.type.TypeFactory.TypeScope, String, String)} instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) { public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, 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) { public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
return new PersistentSet(session); return new PersistentSet(session);
} }

View File

@ -37,11 +37,22 @@ public class SortedMapType extends MapType {
private final Comparator comparator; private final Comparator comparator;
/**
* @deprecated Use {@link #SortedMapType(org.hibernate.type.TypeFactory.TypeScope, String, String, java.util.Comparator)}
* instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public SortedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) { public SortedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, isEmbeddedInXML ); super( typeScope, role, propertyRef, isEmbeddedInXML );
this.comparator = comparator; 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) { public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
PersistentSortedMap map = new PersistentSortedMap(session); PersistentSortedMap map = new PersistentSortedMap(session);
map.setComparator(comparator); map.setComparator(comparator);

View File

@ -35,11 +35,22 @@ import org.hibernate.persister.collection.CollectionPersister;
public class SortedSetType extends SetType { public class SortedSetType extends SetType {
private final Comparator comparator; private final Comparator comparator;
/**
* @deprecated Use {@link #SortedSetType(org.hibernate.type.TypeFactory.TypeScope, String, String, java.util.Comparator)}
* instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public SortedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) { public SortedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
super( typeScope, role, propertyRef, isEmbeddedInXML ); super( typeScope, role, propertyRef, isEmbeddedInXML );
this.comparator = comparator; 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) { public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
PersistentSortedSet set = new PersistentSortedSet(session); PersistentSortedSet set = new PersistentSortedSet(session);
set.setComparator(comparator); set.setComparator(comparator);

View File

@ -167,7 +167,12 @@ public interface Type extends Serializable {
*/ */
public Class getReturnedClass(); public Class getReturnedClass();
/**
* @deprecated To be removed in 5. Removed as part of removing the notion of DOM entity-mode.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@SuppressWarnings( {"UnusedDeclaration"}) @SuppressWarnings( {"UnusedDeclaration"})
@Deprecated
public boolean isXMLElement(); public boolean isXMLElement();
/** /**
@ -392,7 +397,11 @@ public interface Type extends Serializable {
* @param factory The session factory * @param factory The session factory
* *
* @throws HibernateException An error from Hibernate * @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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/ */
@Deprecated
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory)
throws HibernateException; throws HibernateException;
@ -405,7 +414,11 @@ public interface Type extends Serializable {
* @return an instance of the {@link #getReturnedClass() mapped class} * @return an instance of the {@link #getReturnedClass() mapped class}
* *
* @throws HibernateException An error from Hibernate * @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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/ */
@Deprecated
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException; public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException;
/** /**

View File

@ -155,6 +155,12 @@ public final class TypeFactory implements Serializable {
} }
} }
/**
* @deprecated Use {@link #customCollection(String, java.util.Properties, String, String)}
* instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType customCollection( public CollectionType customCollection(
String typeName, String typeName,
Properties typeParameters, Properties typeParameters,
@ -175,6 +181,25 @@ public final class TypeFactory implements Serializable {
return result; 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<UserType> typeClass, Properties parameters) { public CustomType custom(Class<UserType> typeClass, Properties parameters) {
return custom( typeClass, parameters, typeScope ); return custom( typeClass, parameters, typeScope );
} }
@ -209,6 +234,12 @@ public final class TypeFactory implements Serializable {
// one-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // one-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* @deprecated Use {@link #oneToOne(String, ForeignKeyDirection, String, boolean, boolean, String, String)}
* instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public EntityType oneToOne( public EntityType oneToOne(
String persistentClass, String persistentClass,
ForeignKeyDirection foreignKeyType, ForeignKeyDirection foreignKeyType,
@ -222,6 +253,18 @@ public final class TypeFactory implements Serializable {
lazy, unwrapProxy, isEmbeddedInXML, entityName, propertyName ); 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( public EntityType specialOneToOne(
String persistentClass, String persistentClass,
ForeignKeyDirection foreignKeyType, ForeignKeyDirection foreignKeyType,
@ -245,6 +288,12 @@ public final class TypeFactory implements Serializable {
return new ManyToOneType( typeScope, persistentClass, lazy ); return new ManyToOneType( typeScope, persistentClass, lazy );
} }
/**
* @deprecated Use {@link #manyToOne(String, String, boolean, boolean, boolean, boolean)}
* instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public EntityType manyToOne( public EntityType manyToOne(
String persistentClass, String persistentClass,
String uniqueKeyPropertyName, 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // collection type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* @deprecated Use {@link #array(String, String, Class)} instead.
* See Jira issue: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType array(String role, String propertyRef, boolean embedded, Class elementClass) { public CollectionType array(String role, String propertyRef, boolean embedded, Class elementClass) {
return new ArrayType( typeScope, role, propertyRef, elementClass, embedded ); 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType list(String role, String propertyRef, boolean embedded) { public CollectionType list(String role, String propertyRef, boolean embedded) {
return new ListType( typeScope, role, propertyRef, 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType bag(String role, String propertyRef, boolean embedded) { public CollectionType bag(String role, String propertyRef, boolean embedded) {
return new BagType( typeScope, role, propertyRef, 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType idbag(String role, String propertyRef, boolean embedded) { public CollectionType idbag(String role, String propertyRef, boolean embedded) {
return new IdentifierBagType( typeScope, role, propertyRef, 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType map(String role, String propertyRef, boolean embedded) { public CollectionType map(String role, String propertyRef, boolean embedded) {
return new MapType( typeScope, role, propertyRef, 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType orderedMap(String role, String propertyRef, boolean embedded) { public CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
return new OrderedMapType( typeScope, role, propertyRef, 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType sortedMap(String role, String propertyRef, boolean embedded, Comparator comparator) { public CollectionType sortedMap(String role, String propertyRef, boolean embedded, Comparator comparator) {
return new SortedMapType( typeScope, role, propertyRef, comparator, embedded ); 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType set(String role, String propertyRef, boolean embedded) { public CollectionType set(String role, String propertyRef, boolean embedded) {
return new SetType( typeScope, role, propertyRef, 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType orderedSet(String role, String propertyRef, boolean embedded) { public CollectionType orderedSet(String role, String propertyRef, boolean embedded) {
return new OrderedSetType( typeScope, role, propertyRef, 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: <a href="https://hibernate.onjira.com/browse/HHH-7771">HHH-7771</a>
*/
@Deprecated
public CollectionType sortedSet(String role, String propertyRef, boolean embedded, Comparator comparator) { public CollectionType sortedSet(String role, String propertyRef, boolean embedded, Comparator comparator) {
return new SortedSetType( typeScope, role, propertyRef, comparator, embedded ); 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // component type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~