HHH-5182 - Inject SessionFactory into "non-basic" Types
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19374 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
3dce2f17de
commit
e1acc33bb6
|
@ -37,6 +37,6 @@ public class BagBinder extends CollectionBinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Collection createCollection(PersistentClass persistentClass) {
|
protected Collection createCollection(PersistentClass persistentClass) {
|
||||||
return new org.hibernate.mapping.Bag( persistentClass );
|
return new org.hibernate.mapping.Bag( getMappings(), persistentClass );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,6 +163,10 @@ public abstract class CollectionBinder {
|
||||||
private AccessType accessType;
|
private AccessType accessType;
|
||||||
private boolean hibernateExtensionMapping;
|
private boolean hibernateExtensionMapping;
|
||||||
|
|
||||||
|
protected ExtendedMappings getMappings() {
|
||||||
|
return mappings;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isMap() {
|
public boolean isMap() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -700,7 +704,7 @@ public abstract class CollectionBinder {
|
||||||
) {
|
) {
|
||||||
|
|
||||||
log.debug("Binding a OneToMany: {}.{} through a foreign key", propertyHolder.getEntityName(), propertyName);
|
log.debug("Binding a OneToMany: {}.{} through a foreign key", propertyHolder.getEntityName(), propertyName);
|
||||||
org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( collection.getOwner() );
|
org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( extendedMappings, collection.getOwner() );
|
||||||
collection.setElement( oneToMany );
|
collection.setElement( oneToMany );
|
||||||
oneToMany.setReferencedEntityName( collectionType.getName() );
|
oneToMany.setReferencedEntityName( collectionType.getName() );
|
||||||
oneToMany.setIgnoreNotFound( ignoreNotFound );
|
oneToMany.setIgnoreNotFound( ignoreNotFound );
|
||||||
|
|
|
@ -26,7 +26,6 @@ package org.hibernate;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Serializable;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.sql.Blob;
|
import java.sql.Blob;
|
||||||
import java.sql.Clob;
|
import java.sql.Clob;
|
||||||
|
@ -44,7 +43,6 @@ import org.hibernate.intercept.FieldInterceptionHelper;
|
||||||
import org.hibernate.intercept.FieldInterceptor;
|
import org.hibernate.intercept.FieldInterceptor;
|
||||||
import org.hibernate.proxy.HibernateProxy;
|
import org.hibernate.proxy.HibernateProxy;
|
||||||
import org.hibernate.proxy.LazyInitializer;
|
import org.hibernate.proxy.LazyInitializer;
|
||||||
import org.hibernate.type.AnyType;
|
|
||||||
import org.hibernate.type.BigDecimalType;
|
import org.hibernate.type.BigDecimalType;
|
||||||
import org.hibernate.type.BigIntegerType;
|
import org.hibernate.type.BigIntegerType;
|
||||||
import org.hibernate.type.BinaryType;
|
import org.hibernate.type.BinaryType;
|
||||||
|
@ -56,16 +54,13 @@ import org.hibernate.type.CalendarType;
|
||||||
import org.hibernate.type.CharacterType;
|
import org.hibernate.type.CharacterType;
|
||||||
import org.hibernate.type.ClassType;
|
import org.hibernate.type.ClassType;
|
||||||
import org.hibernate.type.ClobType;
|
import org.hibernate.type.ClobType;
|
||||||
import org.hibernate.type.CompositeCustomType;
|
|
||||||
import org.hibernate.type.CurrencyType;
|
import org.hibernate.type.CurrencyType;
|
||||||
import org.hibernate.type.CustomType;
|
|
||||||
import org.hibernate.type.DateType;
|
import org.hibernate.type.DateType;
|
||||||
import org.hibernate.type.DoubleType;
|
import org.hibernate.type.DoubleType;
|
||||||
import org.hibernate.type.FloatType;
|
import org.hibernate.type.FloatType;
|
||||||
import org.hibernate.type.IntegerType;
|
import org.hibernate.type.IntegerType;
|
||||||
import org.hibernate.type.LocaleType;
|
import org.hibernate.type.LocaleType;
|
||||||
import org.hibernate.type.LongType;
|
import org.hibernate.type.LongType;
|
||||||
import org.hibernate.type.ManyToOneType;
|
|
||||||
import org.hibernate.type.ObjectType;
|
import org.hibernate.type.ObjectType;
|
||||||
import org.hibernate.type.SerializableType;
|
import org.hibernate.type.SerializableType;
|
||||||
import org.hibernate.type.ShortType;
|
import org.hibernate.type.ShortType;
|
||||||
|
@ -76,7 +71,6 @@ import org.hibernate.type.TimeZoneType;
|
||||||
import org.hibernate.type.TimestampType;
|
import org.hibernate.type.TimestampType;
|
||||||
import org.hibernate.type.TrueFalseType;
|
import org.hibernate.type.TrueFalseType;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.TypeFactory;
|
|
||||||
import org.hibernate.type.YesNoType;
|
import org.hibernate.type.YesNoType;
|
||||||
import org.hibernate.type.CharArrayType;
|
import org.hibernate.type.CharArrayType;
|
||||||
import org.hibernate.type.WrapperBinaryType;
|
import org.hibernate.type.WrapperBinaryType;
|
||||||
|
@ -84,7 +78,6 @@ import org.hibernate.type.CharacterArrayType;
|
||||||
import org.hibernate.type.MaterializedBlobType;
|
import org.hibernate.type.MaterializedBlobType;
|
||||||
import org.hibernate.type.ImageType;
|
import org.hibernate.type.ImageType;
|
||||||
import org.hibernate.type.MaterializedClobType;
|
import org.hibernate.type.MaterializedClobType;
|
||||||
import org.hibernate.usertype.CompositeUserType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <ul>
|
* <ul>
|
||||||
|
@ -281,83 +274,76 @@ public final class Hibernate {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Hibernate <tt>serializable</tt> type.
|
* A Hibernate <tt>serializable</tt> type.
|
||||||
|
*
|
||||||
|
* @param serializableClass The {@link java.io.Serializable} implementor class.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*
|
||||||
* @deprecated Use {@link SerializableType#SerializableType} instead.
|
* @deprecated Use {@link SerializableType#SerializableType} instead.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({ "unchecked" })
|
||||||
public static Type serializable(Class serializableClass) {
|
public static Type serializable(Class serializableClass) {
|
||||||
return new SerializableType( serializableClass );
|
return new SerializableType( serializableClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Hibernate <tt>any</tt> type.
|
* DO NOT USE!
|
||||||
*
|
*
|
||||||
* @param metaType a type mapping <tt>java.lang.Class</tt> to a single column
|
* @deprecated Use {@link TypeHelper#any} instead.
|
||||||
* @param identifierType the entity identifier type
|
|
||||||
* @return the Type
|
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||||
public static Type any(Type metaType, Type identifierType) {
|
public static Type any(Type metaType, Type identifierType) {
|
||||||
return new AnyType( metaType, identifierType );
|
throw new HibernateException( "Not supported" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Hibernate persistent object (entity) type.
|
* DO NOT USE!
|
||||||
*
|
*
|
||||||
* @param persistentClass a mapped entity class
|
* @deprecated Use {@link TypeHelper#entity} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||||
public static Type entity(Class persistentClass) {
|
public static Type entity(Class persistentClass) {
|
||||||
// not really a many-to-one association *necessarily*
|
throw new HibernateException( "Not supported" );
|
||||||
return new ManyToOneType( persistentClass.getName() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Hibernate persistent object (entity) type.
|
* DO NOT USE!
|
||||||
*
|
*
|
||||||
* @param entityName a mapped entity class
|
* @deprecated Use {@link TypeHelper#entity} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||||
public static Type entity(String entityName) {
|
public static Type entity(String entityName) {
|
||||||
// not really a many-to-one association *necessarily*
|
throw new HibernateException( "Not supported" );
|
||||||
return new ManyToOneType( entityName );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Hibernate custom type.
|
* DO NOT USE!
|
||||||
*
|
*
|
||||||
* @param userTypeClass a class that implements <tt>UserType</tt>
|
* @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
|
||||||
*/
|
*/
|
||||||
public static Type custom(Class userTypeClass) throws HibernateException {
|
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||||
return custom( userTypeClass, null );
|
public static Type custom(Class userTypeClass) {
|
||||||
|
throw new HibernateException( "Not supported" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Hibernate parameterizable custom type.
|
* DO NOT USE!
|
||||||
*
|
*
|
||||||
* @param userTypeClass a class that implements <tt>UserType and ParameterizableType</tt>
|
* @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
|
||||||
* @param parameterNames the names of the parameters passed to the type
|
|
||||||
* @param parameterValues the values of the parameters passed to the type. They must match
|
|
||||||
* up with the order and length of the parameterNames array.
|
|
||||||
*/
|
*/
|
||||||
public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues)
|
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||||
throws HibernateException {
|
public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues) {
|
||||||
Properties parameters = new Properties();
|
throw new HibernateException( "Not supported" );
|
||||||
for ( int i = 0; i < parameterNames.length; i++ ) {
|
|
||||||
parameters.setProperty( parameterNames[i], parameterValues[i] );
|
|
||||||
}
|
|
||||||
return custom( userTypeClass, parameters );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Hibernate parameterizable custom type.
|
* DO NOT USE!
|
||||||
*
|
*
|
||||||
* @param userTypeClass a class that implements <tt>UserType and ParameterizableType</tt>
|
* @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
|
||||||
* @param parameters the parameters as a collection of name/value pairs
|
|
||||||
*/
|
*/
|
||||||
public static Type custom(Class userTypeClass, Properties parameters)
|
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||||
throws HibernateException {
|
public static Type custom(Class userTypeClass, Properties parameters) {
|
||||||
if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
|
throw new HibernateException( "Not supported" );
|
||||||
return TypeFactory.customComponent( userTypeClass, parameters );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return TypeFactory.custom( userTypeClass, parameters );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -995,20 +995,26 @@ public interface Session extends Serializable {
|
||||||
*/
|
*/
|
||||||
public void disableFetchProfile(String name) throws UnknownProfileException;
|
public void disableFetchProfile(String name) throws UnknownProfileException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience access to the {@link TypeHelper} associated with this session's {@link SessionFactory}.
|
||||||
|
* <p/>
|
||||||
|
* Equivalent to calling {@link #getSessionFactory()}.{@link SessionFactory#getTypeHelper getTypeHelper()}
|
||||||
|
*
|
||||||
|
* @return The {@link TypeHelper} associated with this session's {@link SessionFactory}
|
||||||
|
*/
|
||||||
|
public TypeHelper getTypeHelper();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains locking details (LockMode, Timeout and Scope).
|
* Contains locking details (LockMode, Timeout and Scope).
|
||||||
*
|
*/
|
||||||
*/
|
public interface LockRequest {
|
||||||
public interface LockRequest
|
|
||||||
{
|
|
||||||
|
|
||||||
static final int PESSIMISTIC_NO_WAIT = 0;
|
static final int PESSIMISTIC_NO_WAIT = 0;
|
||||||
static final int PESSIMISTIC_WAIT_FOREVER = -1;
|
static final int PESSIMISTIC_WAIT_FOREVER = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the lock mode.
|
* Get the lock mode.
|
||||||
|
*
|
||||||
* @return the lock mode.
|
* @return the lock mode.
|
||||||
*/
|
*/
|
||||||
LockMode getLockMode();
|
LockMode getLockMode();
|
||||||
|
@ -1017,6 +1023,7 @@ public interface Session extends Serializable {
|
||||||
* Specify the LockMode to be used. The default is LockMode.none.
|
* Specify the LockMode to be used. The default is LockMode.none.
|
||||||
*
|
*
|
||||||
* @param lockMode
|
* @param lockMode
|
||||||
|
*
|
||||||
* @return this LockRequest instance for operation chaining.
|
* @return this LockRequest instance for operation chaining.
|
||||||
*/
|
*/
|
||||||
LockRequest setLockMode(LockMode lockMode);
|
LockRequest setLockMode(LockMode lockMode);
|
||||||
|
@ -1033,12 +1040,14 @@ public interface Session extends Serializable {
|
||||||
* The default pessimistic lock behavior is to wait forever for the lock.
|
* The default pessimistic lock behavior is to wait forever for the lock.
|
||||||
*
|
*
|
||||||
* @param timeout is time in milliseconds to wait for lock. -1 means wait forever and 0 means no wait.
|
* @param timeout is time in milliseconds to wait for lock. -1 means wait forever and 0 means no wait.
|
||||||
|
*
|
||||||
* @return this LockRequest instance for operation chaining.
|
* @return this LockRequest instance for operation chaining.
|
||||||
*/
|
*/
|
||||||
LockRequest setTimeOut(int timeout);
|
LockRequest setTimeOut(int timeout);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if locking is cascaded to owned collections and relationships.
|
* Check if locking is cascaded to owned collections and relationships.
|
||||||
|
*
|
||||||
* @return true if locking will be extended to owned collections and relationships.
|
* @return true if locking will be extended to owned collections and relationships.
|
||||||
*/
|
*/
|
||||||
boolean getScope();
|
boolean getScope();
|
||||||
|
@ -1048,6 +1057,7 @@ public interface Session extends Serializable {
|
||||||
* The association must be mapped with <tt>cascade="lock" for scope=true to work.
|
* The association must be mapped with <tt>cascade="lock" for scope=true to work.
|
||||||
*
|
*
|
||||||
* @param scope
|
* @param scope
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
LockRequest setScope(boolean scope);
|
LockRequest setScope(boolean scope);
|
||||||
|
@ -1055,7 +1065,5 @@ public interface Session extends Serializable {
|
||||||
void lock(String entityName, Object object) throws HibernateException;
|
void lock(String entityName, Object object) throws HibernateException;
|
||||||
|
|
||||||
public void lock(Object object) throws HibernateException;
|
public void lock(Object object) throws HibernateException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -386,4 +386,11 @@ public interface SessionFactory extends Referenceable, Serializable {
|
||||||
* @return True if there is such a fetch profile; false otherwise.
|
* @return True if there is such a fetch profile; false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean containsFetchProfileDefinition(String name);
|
public boolean containsFetchProfileDefinition(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve this factory's {@link TypeHelper}
|
||||||
|
*
|
||||||
|
* @return The factory's {@link TypeHelper}
|
||||||
|
*/
|
||||||
|
public TypeHelper getTypeHelper();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.hibernate.type.BasicType;
|
||||||
|
import org.hibernate.type.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides access to the various {@link Type} instances associated with the {@link SessionFactory}.
|
||||||
|
* <p/>
|
||||||
|
* This is intended for use by application developers.
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public interface TypeHelper {
|
||||||
|
/**
|
||||||
|
* Retrieve the basic type registered against the given name.
|
||||||
|
*
|
||||||
|
* @param name The name of the basic type to retrieve
|
||||||
|
*
|
||||||
|
* @return The basic type, or null.
|
||||||
|
*/
|
||||||
|
public BasicType basic(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience form of {@link #basic(String)}. The intended use of this is something like
|
||||||
|
* {@code basic(Integer.class)} or {@code basic(int.class)}
|
||||||
|
*
|
||||||
|
* @param javaType The java type for which to retrieve the type instance.
|
||||||
|
*
|
||||||
|
* @return The basic type, or null.
|
||||||
|
*/
|
||||||
|
public BasicType basic(Class javaType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses heuristics to deduce the proper {@link Type} given a string naming the type or Java class.
|
||||||
|
* <p/>
|
||||||
|
* See {@link org.hibernate.type.TypeResolver#heuristicType(java.lang.String)} for a discussion of the
|
||||||
|
* heuristic algorithm.
|
||||||
|
*
|
||||||
|
* @param name The name of the type or Java class
|
||||||
|
*
|
||||||
|
* @return The deduced type, or null.
|
||||||
|
*
|
||||||
|
* @see org.hibernate.type.TypeResolver#heuristicType(java.lang.String)
|
||||||
|
*/
|
||||||
|
public Type heuristicType(String name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a type representing the given entity.
|
||||||
|
*
|
||||||
|
* @param entityClass The entity Java type.
|
||||||
|
*
|
||||||
|
* @return The type, or null
|
||||||
|
*/
|
||||||
|
public Type entity(Class entityClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a type representing the given entity.
|
||||||
|
*
|
||||||
|
* @param entityName The entity name.
|
||||||
|
*
|
||||||
|
* @return The type, or null
|
||||||
|
*/
|
||||||
|
public Type entity(String entityName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the type for the given user-type class ({@link org.hibernate.usertype.UserType} or
|
||||||
|
* {@link org.hibernate.usertype.CompositeUserType}).
|
||||||
|
*
|
||||||
|
* @param userTypeClass The user type class
|
||||||
|
*
|
||||||
|
* @return The type, or null
|
||||||
|
*/
|
||||||
|
public Type custom(Class userTypeClass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the type for the given user-type class ({@link org.hibernate.usertype.UserType} or
|
||||||
|
* {@link org.hibernate.usertype.CompositeUserType}).
|
||||||
|
*
|
||||||
|
* @param userTypeClass The user type class
|
||||||
|
* @param properties Configuration properties.
|
||||||
|
*
|
||||||
|
* @return The type, or null
|
||||||
|
*/
|
||||||
|
public Type custom(Class userTypeClass, Properties properties);
|
||||||
|
|
||||||
|
public Type any(Type metaType, Type identifierType);
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.action;
|
package org.hibernate.action;
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ import org.hibernate.event.PreUpdateEvent;
|
||||||
import org.hibernate.event.PreUpdateEventListener;
|
import org.hibernate.event.PreUpdateEventListener;
|
||||||
import org.hibernate.event.EventSource;
|
import org.hibernate.event.EventSource;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
|
|
||||||
public final class EntityUpdateAction extends EntityAction {
|
public final class EntityUpdateAction extends EntityAction {
|
||||||
private final Object[] state;
|
private final Object[] state;
|
||||||
|
@ -133,7 +132,7 @@ public final class EntityUpdateAction extends EntityAction {
|
||||||
// get the updated snapshot of the entity state by cloning current state;
|
// get the updated snapshot of the entity state by cloning current state;
|
||||||
// it is safe to copy in place, since by this time no-one else (should have)
|
// it is safe to copy in place, since by this time no-one else (should have)
|
||||||
// has a reference to the array
|
// has a reference to the array
|
||||||
TypeFactory.deepCopy(
|
TypeHelper.deepCopy(
|
||||||
state,
|
state,
|
||||||
persister.getPropertyTypes(),
|
persister.getPropertyTypes(),
|
||||||
persister.getPropertyCheckability(),
|
persister.getPropertyCheckability(),
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.cache;
|
package org.hibernate.cache;
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ import org.hibernate.UnresolvableObjectException;
|
||||||
import org.hibernate.cfg.Settings;
|
import org.hibernate.cfg.Settings;
|
||||||
import org.hibernate.engine.SessionImplementor;
|
import org.hibernate.engine.SessionImplementor;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The standard implementation of the Hibernate QueryCache interface. This
|
* The standard implementation of the Hibernate QueryCache interface. This
|
||||||
|
@ -78,6 +77,7 @@ public class StandardQueryCache implements QueryCache {
|
||||||
this.updateTimestampsCache = updateTimestampsCache;
|
this.updateTimestampsCache = updateTimestampsCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "UnnecessaryBoxing", "unchecked" })
|
||||||
public boolean put(
|
public boolean put(
|
||||||
QueryKey key,
|
QueryKey key,
|
||||||
Type[] returnTypes,
|
Type[] returnTypes,
|
||||||
|
@ -88,7 +88,7 @@ public class StandardQueryCache implements QueryCache {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Long ts = new Long( session.getTimestamp() );
|
Long ts = Long.valueOf( session.getTimestamp() );
|
||||||
|
|
||||||
if ( log.isDebugEnabled() ) {
|
if ( log.isDebugEnabled() ) {
|
||||||
log.debug( "caching query results in region: " + cacheRegion.getName() + "; timestamp=" + ts );
|
log.debug( "caching query results in region: " + cacheRegion.getName() + "; timestamp=" + ts );
|
||||||
|
@ -96,27 +96,23 @@ public class StandardQueryCache implements QueryCache {
|
||||||
|
|
||||||
List cacheable = new ArrayList( result.size() + 1 );
|
List cacheable = new ArrayList( result.size() + 1 );
|
||||||
cacheable.add( ts );
|
cacheable.add( ts );
|
||||||
for ( int i = 0; i < result.size(); i++ ) {
|
for ( Object aResult : result ) {
|
||||||
if ( returnTypes.length == 1 ) {
|
if ( returnTypes.length == 1 ) {
|
||||||
cacheable.add( returnTypes[0].disassemble( result.get( i ), session, null ) );
|
cacheable.add( returnTypes[0].disassemble( aResult, session, null ) );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cacheable.add(
|
cacheable.add(
|
||||||
TypeFactory.disassemble(
|
TypeHelper.disassemble( (Object[]) aResult, returnTypes, null, session, null )
|
||||||
( Object[] ) result.get( i ), returnTypes, null, session, null
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheRegion.put( key, cacheable );
|
cacheRegion.put( key, cacheable );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked" })
|
||||||
public List get(
|
public List get(
|
||||||
QueryKey key,
|
QueryKey key,
|
||||||
Type[] returnTypes,
|
Type[] returnTypes,
|
||||||
|
@ -145,7 +141,7 @@ public class StandardQueryCache implements QueryCache {
|
||||||
returnTypes[0].beforeAssemble( ( Serializable ) cacheable.get( i ), session );
|
returnTypes[0].beforeAssemble( ( Serializable ) cacheable.get( i ), session );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
TypeFactory.beforeAssemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session );
|
TypeHelper.beforeAssemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List result = new ArrayList( cacheable.size() - 1 );
|
List result = new ArrayList( cacheable.size() - 1 );
|
||||||
|
@ -156,9 +152,7 @@ public class StandardQueryCache implements QueryCache {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result.add(
|
result.add(
|
||||||
TypeFactory.assemble(
|
TypeHelper.assemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session, null )
|
||||||
( Serializable[] ) cacheable.get( i ), returnTypes, session, null
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.cache.entry;
|
package org.hibernate.cache.entry;
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ import org.hibernate.event.EventSource;
|
||||||
import org.hibernate.event.PreLoadEvent;
|
import org.hibernate.event.PreLoadEvent;
|
||||||
import org.hibernate.event.PreLoadEventListener;
|
import org.hibernate.event.PreLoadEventListener;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
import org.hibernate.util.ArrayHelper;
|
import org.hibernate.util.ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +65,7 @@ public final class CacheEntry implements Serializable {
|
||||||
final Object owner)
|
final Object owner)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
//disassembled state gets put in a new array (we write to cache by value!)
|
//disassembled state gets put in a new array (we write to cache by value!)
|
||||||
this.disassembledState = TypeFactory.disassemble(
|
this.disassembledState = TypeHelper.disassemble(
|
||||||
state,
|
state,
|
||||||
persister.getPropertyTypes(),
|
persister.getPropertyTypes(),
|
||||||
persister.isLazyPropertiesCacheable() ?
|
persister.isLazyPropertiesCacheable() ?
|
||||||
|
@ -112,11 +111,10 @@ public final class CacheEntry implements Serializable {
|
||||||
final Serializable id,
|
final Serializable id,
|
||||||
final EntityPersister persister,
|
final EntityPersister persister,
|
||||||
final Interceptor interceptor,
|
final Interceptor interceptor,
|
||||||
final EventSource session)
|
final EventSource session) throws HibernateException {
|
||||||
throws HibernateException {
|
|
||||||
|
|
||||||
//assembled state gets put in a new array (we read from cache by value!)
|
//assembled state gets put in a new array (we read from cache by value!)
|
||||||
Object[] assembledProps = TypeFactory.assemble(
|
Object[] assembledProps = TypeHelper.assemble(
|
||||||
values,
|
values,
|
||||||
persister.getPropertyTypes(),
|
persister.getPropertyTypes(),
|
||||||
session, result
|
session, result
|
||||||
|
@ -132,8 +130,8 @@ public final class CacheEntry implements Serializable {
|
||||||
.setPersister(persister);
|
.setPersister(persister);
|
||||||
|
|
||||||
PreLoadEventListener[] listeners = session.getListeners().getPreLoadEventListeners();
|
PreLoadEventListener[] listeners = session.getListeners().getPreLoadEventListeners();
|
||||||
for ( int i = 0; i < listeners.length; i++ ) {
|
for ( PreLoadEventListener listener : listeners ) {
|
||||||
listeners[i].onPreLoad(preLoadEvent);
|
listener.onPreLoad( preLoadEvent );
|
||||||
}
|
}
|
||||||
|
|
||||||
persister.setPropertyValues(
|
persister.setPropertyValues(
|
||||||
|
|
|
@ -132,6 +132,7 @@ import org.hibernate.secure.JACCConfiguration;
|
||||||
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
|
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
|
||||||
import org.hibernate.tool.hbm2ddl.TableMetadata;
|
import org.hibernate.tool.hbm2ddl.TableMetadata;
|
||||||
import org.hibernate.tool.hbm2ddl.IndexMetadata;
|
import org.hibernate.tool.hbm2ddl.IndexMetadata;
|
||||||
|
import org.hibernate.type.BasicType;
|
||||||
import org.hibernate.type.BasicTypeRegistry;
|
import org.hibernate.type.BasicTypeRegistry;
|
||||||
import org.hibernate.type.SerializationException;
|
import org.hibernate.type.SerializationException;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
|
@ -2286,6 +2287,10 @@ public class Configuration implements Serializable {
|
||||||
return typeResolver;
|
return typeResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerTypeOverride(BasicType type) {
|
||||||
|
getTypeResolver().registerTypeOverride( type );
|
||||||
|
}
|
||||||
|
|
||||||
public SessionFactoryObserver getSessionFactoryObserver() {
|
public SessionFactoryObserver getSessionFactoryObserver() {
|
||||||
return sessionFactoryObserver;
|
return sessionFactoryObserver;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1440,7 +1440,7 @@ public final class HbmBinder {
|
||||||
|
|
||||||
Element oneToManyNode = node.element( "one-to-many" );
|
Element oneToManyNode = node.element( "one-to-many" );
|
||||||
if ( oneToManyNode != null ) {
|
if ( oneToManyNode != null ) {
|
||||||
OneToMany oneToMany = new OneToMany( collection.getOwner() );
|
OneToMany oneToMany = new OneToMany( mappings, collection.getOwner() );
|
||||||
collection.setElement( oneToMany );
|
collection.setElement( oneToMany );
|
||||||
bindOneToMany( oneToManyNode, oneToMany, mappings );
|
bindOneToMany( oneToManyNode, oneToMany, mappings );
|
||||||
// we have to set up the table later!! yuck
|
// we have to set up the table later!! yuck
|
||||||
|
@ -2840,7 +2840,7 @@ public final class HbmBinder {
|
||||||
private static final CollectionType MAP = new CollectionType( "map" ) {
|
private static final CollectionType MAP = new CollectionType( "map" ) {
|
||||||
public Collection create(Element node, String path, PersistentClass owner,
|
public Collection create(Element node, String path, PersistentClass owner,
|
||||||
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
||||||
Map map = new Map( owner );
|
Map map = new Map( mappings, owner );
|
||||||
bindCollection( node, map, owner.getEntityName(), path, mappings, inheritedMetas );
|
bindCollection( node, map, owner.getEntityName(), path, mappings, inheritedMetas );
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -2848,7 +2848,7 @@ public final class HbmBinder {
|
||||||
private static final CollectionType SET = new CollectionType( "set" ) {
|
private static final CollectionType SET = new CollectionType( "set" ) {
|
||||||
public Collection create(Element node, String path, PersistentClass owner,
|
public Collection create(Element node, String path, PersistentClass owner,
|
||||||
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
||||||
Set set = new Set( owner );
|
Set set = new Set( mappings, owner );
|
||||||
bindCollection( node, set, owner.getEntityName(), path, mappings, inheritedMetas );
|
bindCollection( node, set, owner.getEntityName(), path, mappings, inheritedMetas );
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
@ -2856,7 +2856,7 @@ public final class HbmBinder {
|
||||||
private static final CollectionType LIST = new CollectionType( "list" ) {
|
private static final CollectionType LIST = new CollectionType( "list" ) {
|
||||||
public Collection create(Element node, String path, PersistentClass owner,
|
public Collection create(Element node, String path, PersistentClass owner,
|
||||||
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
||||||
List list = new List( owner );
|
List list = new List( mappings, owner );
|
||||||
bindCollection( node, list, owner.getEntityName(), path, mappings, inheritedMetas );
|
bindCollection( node, list, owner.getEntityName(), path, mappings, inheritedMetas );
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -2864,7 +2864,7 @@ public final class HbmBinder {
|
||||||
private static final CollectionType BAG = new CollectionType( "bag" ) {
|
private static final CollectionType BAG = new CollectionType( "bag" ) {
|
||||||
public Collection create(Element node, String path, PersistentClass owner,
|
public Collection create(Element node, String path, PersistentClass owner,
|
||||||
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
||||||
Bag bag = new Bag( owner );
|
Bag bag = new Bag( mappings, owner );
|
||||||
bindCollection( node, bag, owner.getEntityName(), path, mappings, inheritedMetas );
|
bindCollection( node, bag, owner.getEntityName(), path, mappings, inheritedMetas );
|
||||||
return bag;
|
return bag;
|
||||||
}
|
}
|
||||||
|
@ -2872,7 +2872,7 @@ public final class HbmBinder {
|
||||||
private static final CollectionType IDBAG = new CollectionType( "idbag" ) {
|
private static final CollectionType IDBAG = new CollectionType( "idbag" ) {
|
||||||
public Collection create(Element node, String path, PersistentClass owner,
|
public Collection create(Element node, String path, PersistentClass owner,
|
||||||
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
||||||
IdentifierBag bag = new IdentifierBag( owner );
|
IdentifierBag bag = new IdentifierBag( mappings, owner );
|
||||||
bindCollection( node, bag, owner.getEntityName(), path, mappings, inheritedMetas );
|
bindCollection( node, bag, owner.getEntityName(), path, mappings, inheritedMetas );
|
||||||
return bag;
|
return bag;
|
||||||
}
|
}
|
||||||
|
@ -2880,7 +2880,7 @@ public final class HbmBinder {
|
||||||
private static final CollectionType ARRAY = new CollectionType( "array" ) {
|
private static final CollectionType ARRAY = new CollectionType( "array" ) {
|
||||||
public Collection create(Element node, String path, PersistentClass owner,
|
public Collection create(Element node, String path, PersistentClass owner,
|
||||||
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
||||||
Array array = new Array( owner );
|
Array array = new Array( mappings, owner );
|
||||||
bindArray( node, array, owner.getEntityName(), path, mappings, inheritedMetas );
|
bindArray( node, array, owner.getEntityName(), path, mappings, inheritedMetas );
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
@ -2888,7 +2888,7 @@ public final class HbmBinder {
|
||||||
private static final CollectionType PRIMITIVE_ARRAY = new CollectionType( "primitive-array" ) {
|
private static final CollectionType PRIMITIVE_ARRAY = new CollectionType( "primitive-array" ) {
|
||||||
public Collection create(Element node, String path, PersistentClass owner,
|
public Collection create(Element node, String path, PersistentClass owner,
|
||||||
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
Mappings mappings, java.util.Map inheritedMetas) throws MappingException {
|
||||||
PrimitiveArray array = new PrimitiveArray( owner );
|
PrimitiveArray array = new PrimitiveArray( mappings, owner );
|
||||||
bindArray( node, array, owner.getEntityName(), path, mappings, inheritedMetas );
|
bindArray( node, array, owner.getEntityName(), path, mappings, inheritedMetas );
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.engine;
|
package org.hibernate.engine;
|
||||||
|
|
||||||
|
@ -44,7 +43,7 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.pretty.MessageHelper;
|
import org.hibernate.pretty.MessageHelper;
|
||||||
import org.hibernate.property.BackrefPropertyAccessor;
|
import org.hibernate.property.BackrefPropertyAccessor;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functionality relating to Hibernate's two-phase loading process,
|
* Functionality relating to Hibernate's two-phase loading process,
|
||||||
|
@ -211,13 +210,13 @@ public final class TwoPhaseLoad {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//take a snapshot
|
//take a snapshot
|
||||||
TypeFactory.deepCopy(
|
TypeHelper.deepCopy(
|
||||||
hydratedState,
|
hydratedState,
|
||||||
persister.getPropertyTypes(),
|
persister.getPropertyTypes(),
|
||||||
persister.getPropertyUpdateability(),
|
persister.getPropertyUpdateability(),
|
||||||
hydratedState, //after setting values to object, entityMode
|
hydratedState, //after setting values to object, entityMode
|
||||||
session
|
session
|
||||||
);
|
);
|
||||||
persistenceContext.setEntryStatus(entityEntry, Status.MANAGED);
|
persistenceContext.setEntryStatus(entityEntry, Status.MANAGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.def;
|
package org.hibernate.event.def;
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ import org.hibernate.event.AbstractEvent;
|
||||||
import org.hibernate.event.EventSource;
|
import org.hibernate.event.EventSource;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.pretty.MessageHelper;
|
import org.hibernate.pretty.MessageHelper;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A convenience base class for listeners that respond to requests to reassociate an entity
|
* A convenience base class for listeners that respond to requests to reassociate an entity
|
||||||
|
@ -77,7 +76,7 @@ public class AbstractReassociateEventListener implements Serializable {
|
||||||
|
|
||||||
//get a snapshot
|
//get a snapshot
|
||||||
Object[] values = persister.getPropertyValues( object, source.getEntityMode() );
|
Object[] values = persister.getPropertyValues( object, source.getEntityMode() );
|
||||||
TypeFactory.deepCopy(
|
TypeHelper.deepCopy(
|
||||||
values,
|
values,
|
||||||
persister.getPropertyTypes(),
|
persister.getPropertyTypes(),
|
||||||
persister.getPropertyUpdateability(),
|
persister.getPropertyUpdateability(),
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.def;
|
package org.hibernate.event.def;
|
||||||
|
|
||||||
|
@ -53,7 +52,7 @@ import org.hibernate.intercept.FieldInterceptor;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.pretty.MessageHelper;
|
import org.hibernate.pretty.MessageHelper;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A convenience bas class for listeners responding to save events.
|
* A convenience bas class for listeners responding to save events.
|
||||||
|
@ -300,7 +299,7 @@ public abstract class AbstractSaveEventListener extends AbstractReassociateEvent
|
||||||
persister.setPropertyValues( entity, values, source.getEntityMode() );
|
persister.setPropertyValues( entity, values, source.getEntityMode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
TypeFactory.deepCopy(
|
TypeHelper.deepCopy(
|
||||||
values,
|
values,
|
||||||
types,
|
types,
|
||||||
persister.getPropertyUpdateability(),
|
persister.getPropertyUpdateability(),
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.event.def;
|
package org.hibernate.event.def;
|
||||||
|
|
||||||
|
@ -34,7 +33,6 @@ import org.hibernate.CacheMode;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.TransientObjectException;
|
import org.hibernate.TransientObjectException;
|
||||||
import org.hibernate.util.IdentitySet;
|
|
||||||
import org.hibernate.action.EntityDeleteAction;
|
import org.hibernate.action.EntityDeleteAction;
|
||||||
import org.hibernate.classic.Lifecycle;
|
import org.hibernate.classic.Lifecycle;
|
||||||
import org.hibernate.engine.Cascade;
|
import org.hibernate.engine.Cascade;
|
||||||
|
@ -51,7 +49,8 @@ import org.hibernate.event.EventSource;
|
||||||
import org.hibernate.persister.entity.EntityPersister;
|
import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.pretty.MessageHelper;
|
import org.hibernate.pretty.MessageHelper;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
|
import org.hibernate.util.IdentitySet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the default delete event listener used by hibernate for deleting entities
|
* Defines the default delete event listener used by hibernate for deleting entities
|
||||||
|
@ -299,7 +298,7 @@ public class DefaultDeleteEventListener implements DeleteEventListener {
|
||||||
// TypeFactory.deepCopy( currentState, propTypes, persister.getPropertyUpdateability(), deletedState, session );
|
// TypeFactory.deepCopy( currentState, propTypes, persister.getPropertyUpdateability(), deletedState, session );
|
||||||
boolean[] copyability = new boolean[propTypes.length];
|
boolean[] copyability = new boolean[propTypes.length];
|
||||||
java.util.Arrays.fill( copyability, true );
|
java.util.Arrays.fill( copyability, true );
|
||||||
TypeFactory.deepCopy( currentState, propTypes, copyability, deletedState, session );
|
TypeHelper.deepCopy( currentState, propTypes, copyability, deletedState, session );
|
||||||
return deletedState;
|
return deletedState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ import org.hibernate.proxy.LazyInitializer;
|
||||||
import org.hibernate.type.EmbeddedComponentType;
|
import org.hibernate.type.EmbeddedComponentType;
|
||||||
import org.hibernate.type.EntityType;
|
import org.hibernate.type.EntityType;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the default load event listeners used by hibernate for loading entities
|
* Defines the default load event listeners used by hibernate for loading entities
|
||||||
|
@ -648,13 +648,13 @@ public class DefaultLoadEventListener extends AbstractLockUpgradeEventListener i
|
||||||
|
|
||||||
Type[] types = subclassPersister.getPropertyTypes();
|
Type[] types = subclassPersister.getPropertyTypes();
|
||||||
Object[] values = entry.assemble( result, id, subclassPersister, session.getInterceptor(), session ); // intializes result by side-effect
|
Object[] values = entry.assemble( result, id, subclassPersister, session.getInterceptor(), session ); // intializes result by side-effect
|
||||||
TypeFactory.deepCopy(
|
TypeHelper.deepCopy(
|
||||||
values,
|
values,
|
||||||
types,
|
types,
|
||||||
subclassPersister.getPropertyUpdateability(),
|
subclassPersister.getPropertyUpdateability(),
|
||||||
values,
|
values,
|
||||||
session
|
session
|
||||||
);
|
);
|
||||||
|
|
||||||
Object version = Versioning.getVersion( values, subclassPersister );
|
Object version = Versioning.getVersion( values, subclassPersister );
|
||||||
if ( log.isTraceEnabled() ) log.trace( "Cached Version: " + version );
|
if ( log.isTraceEnabled() ) log.trace( "Cached Version: " + version );
|
||||||
|
|
|
@ -55,8 +55,8 @@ import org.hibernate.persister.entity.EntityPersister;
|
||||||
import org.hibernate.proxy.HibernateProxy;
|
import org.hibernate.proxy.HibernateProxy;
|
||||||
import org.hibernate.proxy.LazyInitializer;
|
import org.hibernate.proxy.LazyInitializer;
|
||||||
import org.hibernate.type.ForeignKeyDirection;
|
import org.hibernate.type.ForeignKeyDirection;
|
||||||
import org.hibernate.type.TypeFactory;
|
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
|
import org.hibernate.type.TypeHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the default copy event listener used by hibernate for copying entities
|
* Defines the default copy event listener used by hibernate for copying entities
|
||||||
|
@ -492,7 +492,7 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener
|
||||||
final SessionImplementor source,
|
final SessionImplementor source,
|
||||||
final Map copyCache
|
final Map copyCache
|
||||||
) {
|
) {
|
||||||
final Object[] copiedValues = TypeFactory.replace(
|
final Object[] copiedValues = TypeHelper.replace(
|
||||||
persister.getPropertyValues( entity, source.getEntityMode() ),
|
persister.getPropertyValues( entity, source.getEntityMode() ),
|
||||||
persister.getPropertyValues( target, source.getEntityMode() ),
|
persister.getPropertyValues( target, source.getEntityMode() ),
|
||||||
persister.getPropertyTypes(),
|
persister.getPropertyTypes(),
|
||||||
|
@ -518,7 +518,7 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener
|
||||||
// this is the second pass through on a merge op, so here we limit the
|
// this is the second pass through on a merge op, so here we limit the
|
||||||
// replacement to associations types (value types were already replaced
|
// replacement to associations types (value types were already replaced
|
||||||
// during the first pass)
|
// during the first pass)
|
||||||
copiedValues = TypeFactory.replaceAssociations(
|
copiedValues = TypeHelper.replaceAssociations(
|
||||||
persister.getPropertyValues( entity, source.getEntityMode() ),
|
persister.getPropertyValues( entity, source.getEntityMode() ),
|
||||||
persister.getPropertyValues( target, source.getEntityMode() ),
|
persister.getPropertyValues( target, source.getEntityMode() ),
|
||||||
persister.getPropertyTypes(),
|
persister.getPropertyTypes(),
|
||||||
|
@ -529,7 +529,7 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
copiedValues = TypeFactory.replace(
|
copiedValues = TypeHelper.replace(
|
||||||
persister.getPropertyValues( entity, source.getEntityMode() ),
|
persister.getPropertyValues( entity, source.getEntityMode() ),
|
||||||
persister.getPropertyValues( target, source.getEntityMode() ),
|
persister.getPropertyValues( target, source.getEntityMode() ),
|
||||||
persister.getPropertyTypes(),
|
persister.getPropertyTypes(),
|
||||||
|
|
|
@ -117,7 +117,10 @@ class FromElementType {
|
||||||
public Type getSelectType() {
|
public Type getSelectType() {
|
||||||
if (entityType==null) return null;
|
if (entityType==null) return null;
|
||||||
boolean shallow = fromElement.getFromClause().getWalker().isShallowQuery();
|
boolean shallow = fromElement.getFromClause().getWalker().isShallowQuery();
|
||||||
return TypeFactory.manyToOne( entityType.getAssociatedEntityName(), shallow );
|
return fromElement.getSessionFactoryHelper()
|
||||||
|
.getFactory()
|
||||||
|
.getTypeResolver()
|
||||||
|
.getTypeFactory().manyToOne( entityType.getAssociatedEntityName(), shallow );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -113,7 +113,7 @@ public class PathExpressionParser implements Parser {
|
||||||
q.addType( currentName, entityName );
|
q.addType( currentName, entityName );
|
||||||
Queryable classPersister = q.getEntityPersister( entityName );
|
Queryable classPersister = q.getEntityPersister( entityName );
|
||||||
//QueryJoinFragment join = q.createJoinFragment(useThetaStyleJoin);
|
//QueryJoinFragment join = q.createJoinFragment(useThetaStyleJoin);
|
||||||
addJoin( currentName, TypeFactory.manyToOne( entityName ), joinColumns );
|
addJoin( currentName, q.getFactory().getTypeResolver().getTypeFactory().manyToOne( entityName ), joinColumns );
|
||||||
currentPropertyMapping = classPersister;
|
currentPropertyMapping = classPersister;
|
||||||
return currentName;
|
return currentName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,7 +662,9 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for ( int i = 0; i < persisters.length; i++ ) {
|
for ( int i = 0; i < persisters.length; i++ ) {
|
||||||
if ( includeInSelect[i] ) {
|
if ( includeInSelect[i] ) {
|
||||||
actualReturnTypes[j++] = TypeFactory.manyToOne( persisters[i].getEntityName(), shallowQuery );
|
actualReturnTypes[j++] = getFactory().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.manyToOne( persisters[i].getEntityName(), shallowQuery );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -719,7 +721,9 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
||||||
int size = returnedTypes.size();
|
int size = returnedTypes.size();
|
||||||
for ( int k = 0; k < size; k++ ) {
|
for ( int k = 0; k < size; k++ ) {
|
||||||
|
|
||||||
scalarTypes.add( TypeFactory.manyToOne( persisters[k].getEntityName(), shallowQuery ) );
|
scalarTypes.add(
|
||||||
|
getFactory().getTypeResolver().getTypeFactory().manyToOne( persisters[k].getEntityName(), shallowQuery )
|
||||||
|
);
|
||||||
|
|
||||||
String[] idColumnNames = persisters[k].getIdentifierColumnNames();
|
String[] idColumnNames = persisters[k].getIdentifierColumnNames();
|
||||||
for ( int i = 0; i < idColumnNames.length; i++ ) {
|
for ( int i = 0; i < idColumnNames.length; i++ ) {
|
||||||
|
|
|
@ -62,6 +62,7 @@ import org.hibernate.StatelessSession;
|
||||||
import org.hibernate.SessionFactoryObserver;
|
import org.hibernate.SessionFactoryObserver;
|
||||||
import org.hibernate.EntityNameResolver;
|
import org.hibernate.EntityNameResolver;
|
||||||
import org.hibernate.Cache;
|
import org.hibernate.Cache;
|
||||||
|
import org.hibernate.TypeHelper;
|
||||||
import org.hibernate.tuple.entity.EntityTuplizer;
|
import org.hibernate.tuple.entity.EntityTuplizer;
|
||||||
import org.hibernate.cache.CacheKey;
|
import org.hibernate.cache.CacheKey;
|
||||||
import org.hibernate.cache.CollectionRegion;
|
import org.hibernate.cache.CollectionRegion;
|
||||||
|
@ -114,7 +115,6 @@ import org.hibernate.pretty.MessageHelper;
|
||||||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||||
import org.hibernate.stat.Statistics;
|
import org.hibernate.stat.Statistics;
|
||||||
import org.hibernate.stat.StatisticsImpl;
|
import org.hibernate.stat.StatisticsImpl;
|
||||||
import org.hibernate.stat.ConcurrentStatisticsImpl;
|
|
||||||
import org.hibernate.stat.StatisticsImplementor;
|
import org.hibernate.stat.StatisticsImplementor;
|
||||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||||
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
||||||
|
@ -191,6 +191,7 @@ public final class SessionFactoryImpl implements SessionFactory, SessionFactoryI
|
||||||
private final transient Cache cacheAccess = new CacheImpl();
|
private final transient Cache cacheAccess = new CacheImpl();
|
||||||
private transient boolean isClosed = false;
|
private transient boolean isClosed = false;
|
||||||
private final transient TypeResolver typeResolver;
|
private final transient TypeResolver typeResolver;
|
||||||
|
private final transient TypeHelper typeHelper;
|
||||||
|
|
||||||
public SessionFactoryImpl(
|
public SessionFactoryImpl(
|
||||||
Configuration cfg,
|
Configuration cfg,
|
||||||
|
@ -234,6 +235,7 @@ public final class SessionFactoryImpl implements SessionFactory, SessionFactoryI
|
||||||
};
|
};
|
||||||
|
|
||||||
this.typeResolver = cfg.getTypeResolver().scope( this );
|
this.typeResolver = cfg.getTypeResolver().scope( this );
|
||||||
|
this.typeHelper = new TypeLocatorImpl( typeResolver );
|
||||||
|
|
||||||
this.filters = new HashMap();
|
this.filters = new HashMap();
|
||||||
this.filters.putAll( cfg.getFilterDefinitions() );
|
this.filters.putAll( cfg.getFilterDefinitions() );
|
||||||
|
@ -1302,6 +1304,10 @@ public final class SessionFactoryImpl implements SessionFactory, SessionFactoryI
|
||||||
return ( FetchProfile ) fetchProfiles.get( name );
|
return ( FetchProfile ) fetchProfiles.get( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TypeHelper getTypeHelper() {
|
||||||
|
return typeHelper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom serialization hook used during Session serialization.
|
* Custom serialization hook used during Session serialization.
|
||||||
*
|
*
|
||||||
|
|
|
@ -66,6 +66,7 @@ import org.hibernate.SessionException;
|
||||||
import org.hibernate.SessionFactory;
|
import org.hibernate.SessionFactory;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
import org.hibernate.TransientObjectException;
|
import org.hibernate.TransientObjectException;
|
||||||
|
import org.hibernate.TypeHelper;
|
||||||
import org.hibernate.UnresolvableObjectException;
|
import org.hibernate.UnresolvableObjectException;
|
||||||
import org.hibernate.UnknownProfileException;
|
import org.hibernate.UnknownProfileException;
|
||||||
import org.hibernate.EntityNameResolver;
|
import org.hibernate.EntityNameResolver;
|
||||||
|
@ -2213,6 +2214,13 @@ public final class SessionImpl extends AbstractSessionImpl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public TypeHelper getTypeHelper() {
|
||||||
|
return getSessionFactory().getTypeHelper();
|
||||||
|
}
|
||||||
|
|
||||||
private class CoordinatingEntityNameResolver implements EntityNameResolver {
|
private class CoordinatingEntityNameResolver implements EntityNameResolver {
|
||||||
public String resolveEntityName(Object entity) {
|
public String resolveEntityName(Object entity) {
|
||||||
String entityName = interceptor.getEntityName( entity );
|
String entityName = interceptor.getEntityName( entity );
|
||||||
|
|
|
@ -0,0 +1,186 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.impl;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.hibernate.TypeHelper;
|
||||||
|
import org.hibernate.type.BasicType;
|
||||||
|
import org.hibernate.type.Type;
|
||||||
|
import org.hibernate.type.TypeResolver;
|
||||||
|
import org.hibernate.usertype.CompositeUserType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of {@link org.hibernate.TypeHelper}
|
||||||
|
*
|
||||||
|
* @todo Do we want to cache the results of {@link #entity}, {@link #custom} and {@link #any} ?
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class TypeLocatorImpl implements TypeHelper, Serializable {
|
||||||
|
private final TypeResolver typeResolver;
|
||||||
|
|
||||||
|
public TypeLocatorImpl(TypeResolver typeResolver) {
|
||||||
|
this.typeResolver = typeResolver;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public BasicType basic(String name) {
|
||||||
|
return typeResolver.basic( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public BasicType basic(Class javaType) {
|
||||||
|
BasicType type = typeResolver.basic( javaType.getName() );
|
||||||
|
if ( type == null ) {
|
||||||
|
final Class variant = resolvePrimitiveOrPrimitiveWrapperVariantJavaType( javaType );
|
||||||
|
if ( variant != null ) {
|
||||||
|
type = typeResolver.basic( variant.getName() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Class resolvePrimitiveOrPrimitiveWrapperVariantJavaType(Class javaType) {
|
||||||
|
// boolean
|
||||||
|
if ( Boolean.TYPE.equals( javaType ) ) {
|
||||||
|
return Boolean.class;
|
||||||
|
}
|
||||||
|
if ( Boolean.class.equals( javaType ) ) {
|
||||||
|
return Boolean.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// char
|
||||||
|
if ( Character.TYPE.equals( javaType ) ) {
|
||||||
|
return Character.class;
|
||||||
|
}
|
||||||
|
if ( Character.class.equals( javaType ) ) {
|
||||||
|
return Character.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// byte
|
||||||
|
if ( Byte.TYPE.equals( javaType ) ) {
|
||||||
|
return Byte.class;
|
||||||
|
}
|
||||||
|
if ( Byte.class.equals( javaType ) ) {
|
||||||
|
return Byte.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// short
|
||||||
|
if ( Short.TYPE.equals( javaType ) ) {
|
||||||
|
return Short.class;
|
||||||
|
}
|
||||||
|
if ( Short.class.equals( javaType ) ) {
|
||||||
|
return Short.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// int
|
||||||
|
if ( Integer.TYPE.equals( javaType ) ) {
|
||||||
|
return Integer.class;
|
||||||
|
}
|
||||||
|
if ( Integer.class.equals( javaType ) ) {
|
||||||
|
return Integer.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// long
|
||||||
|
if ( Long.TYPE.equals( javaType ) ) {
|
||||||
|
return Long.class;
|
||||||
|
}
|
||||||
|
if ( Long.class.equals( javaType ) ) {
|
||||||
|
return Long.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// float
|
||||||
|
if ( Float.TYPE.equals( javaType ) ) {
|
||||||
|
return Float.class;
|
||||||
|
}
|
||||||
|
if ( Float.class.equals( javaType ) ) {
|
||||||
|
return Float.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// double
|
||||||
|
if ( Double.TYPE.equals( javaType ) ) {
|
||||||
|
return Double.class;
|
||||||
|
}
|
||||||
|
if ( Double.class.equals( javaType ) ) {
|
||||||
|
return Double.TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public Type heuristicType(String name) {
|
||||||
|
return typeResolver.heuristicType( name );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public Type entity(Class entityClass) {
|
||||||
|
return entity( entityClass.getName() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public Type entity(String entityName) {
|
||||||
|
return typeResolver.getTypeFactory().manyToOne( entityName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
public Type custom(Class userTypeClass) {
|
||||||
|
return custom( userTypeClass, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unchecked" })
|
||||||
|
public Type custom(Class userTypeClass, Properties parameters) {
|
||||||
|
if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
|
||||||
|
return typeResolver.getTypeFactory().customComponent( userTypeClass, parameters );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return typeResolver.getTypeFactory().custom( userTypeClass, parameters );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public Type any(Type metaType, Type identifierType) {
|
||||||
|
return typeResolver.getTypeFactory().any( metaType, identifierType );
|
||||||
|
}
|
||||||
|
}
|
|
@ -109,7 +109,7 @@ public class CriteriaJoinWalker extends AbstractEntityJoinWalker {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
resultTypes = new Type[] { TypeFactory.manyToOne( persister.getEntityName() ) };
|
resultTypes = new Type[] { factory.getTypeResolver().getTypeFactory().manyToOne( persister.getEntityName() ) };
|
||||||
|
|
||||||
initAll( translator.getWhereCondition(), translator.getOrderBy(), LockOptions.NONE );
|
initAll( translator.getWhereCondition(), translator.getOrderBy(), LockOptions.NONE );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,8 @@ public class Any extends SimpleValue {
|
||||||
|
|
||||||
public Type getType() throws MappingException {
|
public Type getType() throws MappingException {
|
||||||
final Type metaType = getMappings().getTypeResolver().heuristicType( metaTypeName );
|
final Type metaType = getMappings().getTypeResolver().heuristicType( metaTypeName );
|
||||||
return new AnyType(
|
|
||||||
|
return getMappings().getTypeResolver().getTypeFactory().any(
|
||||||
metaValues == null ? metaType : new MetaType( metaValues, metaType ),
|
metaValues == null ? metaType : new MetaType( metaValues, metaType ),
|
||||||
getMappings().getTypeResolver().heuristicType( identifierTypeName )
|
getMappings().getTypeResolver().heuristicType( identifierTypeName )
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,31 +20,27 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
import org.hibernate.type.PrimitiveType;
|
import org.hibernate.type.PrimitiveType;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeFactory;
|
||||||
import org.hibernate.util.ReflectHelper;
|
import org.hibernate.util.ReflectHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array mapping has a primary key consisting of
|
* An array mapping has a primary key consisting of the key columns + index column.
|
||||||
* the key columns + index column.
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class Array extends List {
|
public class Array extends List {
|
||||||
|
|
||||||
private String elementClassName;
|
private String elementClassName;
|
||||||
|
|
||||||
/**
|
public Array(Mappings mappings, PersistentClass owner) {
|
||||||
* Constructor for Array.
|
super( mappings, owner );
|
||||||
* @param owner
|
|
||||||
*/
|
|
||||||
public Array(PersistentClass owner) {
|
|
||||||
super(owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Class getElementClass() throws MappingException {
|
public Class getElementClass() throws MappingException {
|
||||||
|
@ -65,7 +61,9 @@ public class Array extends List {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollectionType getDefaultCollectionType() throws MappingException {
|
public CollectionType getDefaultCollectionType() throws MappingException {
|
||||||
return TypeFactory.array( getRole(), getReferencedPropertyName(), isEmbedded(), getElementClass() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.array( getRole(), getReferencedPropertyName(), isEmbedded(), getElementClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isArray() {
|
public boolean isArray() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,12 +20,11 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
import org.hibernate.type.TypeFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A bag permits duplicates, so it has no primary key
|
* A bag permits duplicates, so it has no primary key
|
||||||
|
@ -34,12 +33,14 @@ import org.hibernate.type.TypeFactory;
|
||||||
*/
|
*/
|
||||||
public class Bag extends Collection {
|
public class Bag extends Collection {
|
||||||
|
|
||||||
public Bag(PersistentClass owner) {
|
public Bag(Mappings mappings, PersistentClass owner) {
|
||||||
super(owner);
|
super( mappings, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollectionType getDefaultCollectionType() {
|
public CollectionType getDefaultCollectionType() {
|
||||||
return TypeFactory.bag( getRole(), getReferencedPropertyName(), isEmbedded() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.bag( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void createPrimaryKey() {
|
void createPrimaryKey() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
@ -32,6 +31,7 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.hibernate.FetchMode;
|
import org.hibernate.FetchMode;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.engine.Mapping;
|
import org.hibernate.engine.Mapping;
|
||||||
import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
|
import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
|
@ -51,6 +51,9 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
||||||
public static final String DEFAULT_ELEMENT_COLUMN_NAME = "elt";
|
public static final String DEFAULT_ELEMENT_COLUMN_NAME = "elt";
|
||||||
public static final String DEFAULT_KEY_COLUMN_NAME = "id";
|
public static final String DEFAULT_KEY_COLUMN_NAME = "id";
|
||||||
|
|
||||||
|
private final Mappings mappings;
|
||||||
|
private PersistentClass owner;
|
||||||
|
|
||||||
private KeyValue key;
|
private KeyValue key;
|
||||||
private Value element;
|
private Value element;
|
||||||
private Table collectionTable;
|
private Table collectionTable;
|
||||||
|
@ -66,7 +69,6 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
||||||
private String where;
|
private String where;
|
||||||
private String manyToManyWhere;
|
private String manyToManyWhere;
|
||||||
private String manyToManyOrderBy;
|
private String manyToManyOrderBy;
|
||||||
private PersistentClass owner;
|
|
||||||
private String referencedPropertyName;
|
private String referencedPropertyName;
|
||||||
private String nodeName;
|
private String nodeName;
|
||||||
private String elementNodeName;
|
private String elementNodeName;
|
||||||
|
@ -100,10 +102,15 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
||||||
|
|
||||||
private String loaderName;
|
private String loaderName;
|
||||||
|
|
||||||
protected Collection(PersistentClass owner) {
|
protected Collection(Mappings mappings, PersistentClass owner) {
|
||||||
|
this.mappings = mappings;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mappings getMappings() {
|
||||||
|
return mappings;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSet() {
|
public boolean isSet() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -221,6 +228,11 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
||||||
return owner;
|
return owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Inject the owner into constructor.
|
||||||
|
*
|
||||||
|
* @param owner The owner
|
||||||
|
*/
|
||||||
public void setOwner(PersistentClass owner) {
|
public void setOwner(PersistentClass owner) {
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -183,10 +183,10 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
// TODO : temporary initial step towards HHH-1907
|
// TODO : temporary initial step towards HHH-1907
|
||||||
ComponentMetamodel metamodel = new ComponentMetamodel( this );
|
ComponentMetamodel metamodel = new ComponentMetamodel( this );
|
||||||
if ( isEmbedded() ) {
|
if ( isEmbedded() ) {
|
||||||
return new EmbeddedComponentType( metamodel );
|
return getMappings().getTypeResolver().getTypeFactory().embeddedComponent( metamodel );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return new ComponentType( metamodel );
|
return getMappings().getTypeResolver().getTypeFactory().component( metamodel );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,10 +20,10 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeFactory;
|
||||||
|
|
||||||
|
@ -33,12 +33,14 @@ import org.hibernate.type.TypeFactory;
|
||||||
*/
|
*/
|
||||||
public class IdentifierBag extends IdentifierCollection {
|
public class IdentifierBag extends IdentifierCollection {
|
||||||
|
|
||||||
public IdentifierBag(PersistentClass owner) {
|
public IdentifierBag(Mappings mappings, PersistentClass owner) {
|
||||||
super(owner);
|
super( mappings, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollectionType getDefaultCollectionType() {
|
public CollectionType getDefaultCollectionType() {
|
||||||
return TypeFactory.idbag( getRole(), getReferencedPropertyName(), isEmbedded() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.idbag( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object accept(ValueVisitor visitor) {
|
public Object accept(ValueVisitor visitor) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.engine.Mapping;
|
import org.hibernate.engine.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,8 +36,8 @@ public abstract class IdentifierCollection extends Collection {
|
||||||
|
|
||||||
private KeyValue identifier;
|
private KeyValue identifier;
|
||||||
|
|
||||||
public IdentifierCollection(PersistentClass owner) {
|
public IdentifierCollection(Mappings mappings, PersistentClass owner) {
|
||||||
super(owner);
|
super( mappings, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyValue getIdentifier() {
|
public KeyValue getIdentifier() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,13 +20,13 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.engine.Mapping;
|
import org.hibernate.engine.Mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,8 +41,8 @@ public abstract class IndexedCollection extends Collection {
|
||||||
private Value index;
|
private Value index;
|
||||||
private String indexNodeName;
|
private String indexNodeName;
|
||||||
|
|
||||||
public IndexedCollection(PersistentClass owner) {
|
public IndexedCollection(Mappings mappings, PersistentClass owner) {
|
||||||
super(owner);
|
super( mappings, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Value getIndex() {
|
public Value getIndex() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,17 +20,17 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list mapping has a primary key consisting of
|
* A list mapping has a primary key consisting of the key columns + index column.
|
||||||
* the key columns + index column.
|
*
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class List extends IndexedCollection {
|
public class List extends IndexedCollection {
|
||||||
|
@ -41,12 +41,14 @@ public class List extends IndexedCollection {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List(PersistentClass owner) {
|
public List(Mappings mappings, PersistentClass owner) {
|
||||||
super(owner);
|
super( mappings, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
public CollectionType getDefaultCollectionType() throws MappingException {
|
public CollectionType getDefaultCollectionType() throws MappingException {
|
||||||
return TypeFactory.list( getRole(), getReferencedPropertyName(), isEmbedded() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.list( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object accept(ValueVisitor visitor) {
|
public Object accept(ValueVisitor visitor) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
@ -47,7 +46,7 @@ public class ManyToOne extends ToOne {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Type getType() throws MappingException {
|
public Type getType() throws MappingException {
|
||||||
return TypeFactory.manyToOne(
|
return getMappings().getTypeResolver().getTypeFactory().manyToOne(
|
||||||
getReferencedEntityName(),
|
getReferencedEntityName(),
|
||||||
getReferencedPropertyName(),
|
getReferencedPropertyName(),
|
||||||
isLazy(),
|
isLazy(),
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,11 +20,11 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeFactory;
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ import org.hibernate.type.TypeFactory;
|
||||||
*/
|
*/
|
||||||
public class Map extends IndexedCollection {
|
public class Map extends IndexedCollection {
|
||||||
|
|
||||||
public Map(PersistentClass owner) {
|
public Map(Mappings mappings, PersistentClass owner) {
|
||||||
super(owner);
|
super( mappings, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMap() {
|
public boolean isMap() {
|
||||||
|
@ -44,13 +44,19 @@ public class Map extends IndexedCollection {
|
||||||
|
|
||||||
public CollectionType getDefaultCollectionType() {
|
public CollectionType getDefaultCollectionType() {
|
||||||
if ( isSorted() ) {
|
if ( isSorted() ) {
|
||||||
return TypeFactory.sortedMap( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.sortedMap( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
|
||||||
}
|
}
|
||||||
else if ( hasOrder() ) {
|
else if ( hasOrder() ) {
|
||||||
return TypeFactory.orderedMap( getRole(), getReferencedPropertyName(), isEmbedded() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.orderedMap( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return TypeFactory.map( getRole(), getReferencedPropertyName(), isEmbedded() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.map( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
@ -28,6 +27,7 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import org.hibernate.FetchMode;
|
import org.hibernate.FetchMode;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.engine.Mapping;
|
import org.hibernate.engine.Mapping;
|
||||||
import org.hibernate.type.EntityType;
|
import org.hibernate.type.EntityType;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
|
@ -39,24 +39,28 @@ import org.hibernate.type.TypeFactory;
|
||||||
*/
|
*/
|
||||||
public class OneToMany implements Value {
|
public class OneToMany implements Value {
|
||||||
|
|
||||||
|
private final Mappings mappings;
|
||||||
|
private final Table referencingTable;
|
||||||
|
|
||||||
private String referencedEntityName;
|
private String referencedEntityName;
|
||||||
private Table referencingTable;
|
|
||||||
private PersistentClass associatedClass;
|
private PersistentClass associatedClass;
|
||||||
private boolean embedded;
|
private boolean embedded;
|
||||||
private boolean ignoreNotFound;
|
private boolean ignoreNotFound;
|
||||||
|
|
||||||
private EntityType getEntityType() {
|
private EntityType getEntityType() {
|
||||||
return TypeFactory.manyToOne(
|
return mappings.getTypeResolver().getTypeFactory().manyToOne(
|
||||||
getReferencedEntityName(),
|
getReferencedEntityName(),
|
||||||
null,
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
isEmbedded(),
|
isEmbedded(),
|
||||||
isIgnoreNotFound()
|
isIgnoreNotFound(),
|
||||||
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OneToMany(PersistentClass owner) throws MappingException {
|
public OneToMany(Mappings mappings, PersistentClass owner) throws MappingException {
|
||||||
|
this.mappings = mappings;
|
||||||
this.referencingTable = (owner==null) ? null : owner.getTable();
|
this.referencingTable = (owner==null) ? null : owner.getTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
@ -71,7 +70,7 @@ public class OneToOne extends ToOne {
|
||||||
|
|
||||||
public Type getType() throws MappingException {
|
public Type getType() throws MappingException {
|
||||||
if ( getColumnIterator().hasNext() ) {
|
if ( getColumnIterator().hasNext() ) {
|
||||||
return new SpecialOneToOneType(
|
return getMappings().getTypeResolver().getTypeFactory().specialOneToOne(
|
||||||
getReferencedEntityName(),
|
getReferencedEntityName(),
|
||||||
foreignKeyType,
|
foreignKeyType,
|
||||||
referencedPropertyName,
|
referencedPropertyName,
|
||||||
|
@ -79,10 +78,10 @@ public class OneToOne extends ToOne {
|
||||||
isUnwrapProxy(),
|
isUnwrapProxy(),
|
||||||
entityName,
|
entityName,
|
||||||
propertyName
|
propertyName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return TypeFactory.oneToOne(
|
return getMappings().getTypeResolver().getTypeFactory().oneToOne(
|
||||||
getReferencedEntityName(),
|
getReferencedEntityName(),
|
||||||
foreignKeyType,
|
foreignKeyType,
|
||||||
referencedPropertyName,
|
referencedPropertyName,
|
||||||
|
@ -91,7 +90,7 @@ public class OneToOne extends ToOne {
|
||||||
isEmbedded(),
|
isEmbedded(),
|
||||||
entityName,
|
entityName,
|
||||||
propertyName
|
propertyName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,18 +20,18 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A primitive array has a primary key consisting
|
* A primitive array has a primary key consisting of the key columns + index column.
|
||||||
* of the key columns + index column.
|
|
||||||
*/
|
*/
|
||||||
public class PrimitiveArray extends Array {
|
public class PrimitiveArray extends Array {
|
||||||
|
|
||||||
public PrimitiveArray(PersistentClass owner) {
|
public PrimitiveArray(Mappings mappings, PersistentClass owner) {
|
||||||
super(owner);
|
super( mappings, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPrimitiveArray() {
|
public boolean isPrimitiveArray() {
|
||||||
|
@ -42,10 +42,3 @@ public class PrimitiveArray extends Array {
|
||||||
return visitor.accept(this);
|
return visitor.accept(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,13 +20,13 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
|
import org.hibernate.cfg.Mappings;
|
||||||
import org.hibernate.engine.Mapping;
|
import org.hibernate.engine.Mapping;
|
||||||
import org.hibernate.type.CollectionType;
|
import org.hibernate.type.CollectionType;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeFactory;
|
||||||
|
@ -51,12 +51,8 @@ public class Set extends Collection {
|
||||||
throw new MappingException("set element mappings must have at least one non-nullable column: " + getRole() );*/
|
throw new MappingException("set element mappings must have at least one non-nullable column: " + getRole() );*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public Set(Mappings mappings, PersistentClass owner) {
|
||||||
* Constructor for Set.
|
super( mappings, owner );
|
||||||
* @param owner
|
|
||||||
*/
|
|
||||||
public Set(PersistentClass owner) {
|
|
||||||
super(owner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSet() {
|
public boolean isSet() {
|
||||||
|
@ -65,13 +61,19 @@ public class Set extends Collection {
|
||||||
|
|
||||||
public CollectionType getDefaultCollectionType() {
|
public CollectionType getDefaultCollectionType() {
|
||||||
if ( isSorted() ) {
|
if ( isSorted() ) {
|
||||||
return TypeFactory.sortedSet( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.sortedSet( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
|
||||||
}
|
}
|
||||||
else if ( hasOrder() ) {
|
else if ( hasOrder() ) {
|
||||||
return TypeFactory.orderedSet( getRole(), getReferencedPropertyName(), isEmbedded() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.orderedSet( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return TypeFactory.set( getRole(), getReferencedPropertyName(), isEmbedded() );
|
return getMappings().getTypeResolver()
|
||||||
|
.getTypeFactory()
|
||||||
|
.set( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
* indicated by the @author tags or express copyright attribution
|
* indicated by the @author tags or express copyright attribution
|
||||||
* statements applied by the authors. All third-party contributions are
|
* statements applied by the authors. All third-party contributions are
|
||||||
* distributed under license by Red Hat Middleware LLC.
|
* distributed under license by Red Hat Inc.
|
||||||
*
|
*
|
||||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
* Free Software Foundation, Inc.
|
* Free Software Foundation, Inc.
|
||||||
* 51 Franklin Street, Fifth Floor
|
* 51 Franklin Street, Fifth Floor
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<!--
|
<!--
|
||||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||||
~
|
~
|
||||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
~ indicated by the @author tags or express copyright attribution
|
~ indicated by the @author tags or express copyright attribution
|
||||||
~ statements applied by the authors. All third-party contributions are
|
~ statements applied by the authors. All third-party contributions are
|
||||||
~ distributed under license by Red Hat Middleware LLC.
|
~ distributed under license by Red Hat Inc.
|
||||||
~
|
~
|
||||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
~ Free Software Foundation, Inc.
|
~ Free Software Foundation, Inc.
|
||||||
~ 51 Franklin Street, Fifth Floor
|
~ 51 Franklin Street, Fifth Floor
|
||||||
~ Boston, MA 02110-1301 USA
|
~ Boston, MA 02110-1301 USA
|
||||||
~
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
|
|
|
@ -107,7 +107,7 @@ import org.hibernate.type.AbstractComponentType;
|
||||||
import org.hibernate.type.AssociationType;
|
import org.hibernate.type.AssociationType;
|
||||||
import org.hibernate.type.EntityType;
|
import org.hibernate.type.EntityType;
|
||||||
import org.hibernate.type.Type;
|
import org.hibernate.type.Type;
|
||||||
import org.hibernate.type.TypeFactory;
|
import org.hibernate.type.TypeHelper;
|
||||||
import org.hibernate.type.VersionType;
|
import org.hibernate.type.VersionType;
|
||||||
import org.hibernate.util.ArrayHelper;
|
import org.hibernate.util.ArrayHelper;
|
||||||
import org.hibernate.util.FilterHelper;
|
import org.hibernate.util.FilterHelper;
|
||||||
|
@ -3377,7 +3377,7 @@ public abstract class AbstractEntityPersister
|
||||||
*/
|
*/
|
||||||
public int[] findDirty(Object[] currentState, Object[] previousState, Object entity, SessionImplementor session)
|
public int[] findDirty(Object[] currentState, Object[] previousState, Object entity, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
int[] props = TypeFactory.findDirty(
|
int[] props = TypeHelper.findDirty(
|
||||||
entityMetamodel.getProperties(),
|
entityMetamodel.getProperties(),
|
||||||
currentState,
|
currentState,
|
||||||
previousState,
|
previousState,
|
||||||
|
@ -3406,7 +3406,7 @@ public abstract class AbstractEntityPersister
|
||||||
*/
|
*/
|
||||||
public int[] findModified(Object[] old, Object[] current, Object entity, SessionImplementor session)
|
public int[] findModified(Object[] old, Object[] current, Object entity, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
int[] props = TypeFactory.findModified(
|
int[] props = TypeHelper.findModified(
|
||||||
entityMetamodel.getProperties(),
|
entityMetamodel.getProperties(),
|
||||||
current,
|
current,
|
||||||
old,
|
old,
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class EntityMetamodel implements Serializable {
|
||||||
|
|
||||||
name = persistentClass.getEntityName();
|
name = persistentClass.getEntityName();
|
||||||
rootName = persistentClass.getRootClass().getEntityName();
|
rootName = persistentClass.getRootClass().getEntityName();
|
||||||
entityType = TypeFactory.manyToOne( name );
|
entityType = sessionFactory.getTypeResolver().getTypeFactory().manyToOne( name );
|
||||||
|
|
||||||
identifierProperty = PropertyFactory.buildIdentifierProperty(
|
identifierProperty = PropertyFactory.buildIdentifierProperty(
|
||||||
persistentClass,
|
persistentClass,
|
||||||
|
|
|
@ -48,8 +48,8 @@ public class ArrayType extends CollectionType {
|
||||||
private final Class elementClass;
|
private final Class elementClass;
|
||||||
private final Class arrayClass;
|
private final Class arrayClass;
|
||||||
|
|
||||||
public ArrayType(String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) {
|
public ArrayType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) {
|
||||||
super(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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
||||||
|
|
||||||
public class BagType extends CollectionType {
|
public class BagType extends CollectionType {
|
||||||
|
|
||||||
public BagType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
public BagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||||
super(role, propertyRef, isEmbeddedInXML);
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key)
|
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key)
|
||||||
|
|
|
@ -66,11 +66,13 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
private static final Object NOT_NULL_COLLECTION = new MarkerObject( "NOT NULL COLLECTION" );
|
private static final Object NOT_NULL_COLLECTION = new MarkerObject( "NOT NULL COLLECTION" );
|
||||||
public static final Object UNFETCHED_COLLECTION = new MarkerObject( "UNFETCHED COLLECTION" );
|
public static final Object UNFETCHED_COLLECTION = new MarkerObject( "UNFETCHED COLLECTION" );
|
||||||
|
|
||||||
|
private final TypeFactory.TypeScope typeScope;
|
||||||
private final String role;
|
private final String role;
|
||||||
private final String foreignKeyPropertyName;
|
private final String foreignKeyPropertyName;
|
||||||
private final boolean isEmbeddedInXML;
|
private final boolean isEmbeddedInXML;
|
||||||
|
|
||||||
public CollectionType(String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
|
public CollectionType(TypeFactory.TypeScope typeScope, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
|
||||||
|
this.typeScope = typeScope;
|
||||||
this.role = role;
|
this.role = role;
|
||||||
this.foreignKeyPropertyName = foreignKeyPropertyName;
|
this.foreignKeyPropertyName = foreignKeyPropertyName;
|
||||||
this.isEmbeddedInXML = isEmbeddedInXML;
|
this.isEmbeddedInXML = isEmbeddedInXML;
|
||||||
|
|
|
@ -56,6 +56,7 @@ import org.hibernate.util.StringHelper;
|
||||||
*/
|
*/
|
||||||
public class ComponentType extends AbstractType implements AbstractComponentType {
|
public class ComponentType extends AbstractType implements AbstractComponentType {
|
||||||
|
|
||||||
|
private final TypeFactory.TypeScope typeScope;
|
||||||
private final String[] propertyNames;
|
private final String[] propertyNames;
|
||||||
private final Type[] propertyTypes;
|
private final Type[] propertyTypes;
|
||||||
private final boolean[] propertyNullability;
|
private final boolean[] propertyNullability;
|
||||||
|
@ -66,7 +67,8 @@ public class ComponentType extends AbstractType implements AbstractComponentType
|
||||||
|
|
||||||
protected final EntityModeToTuplizerMapping tuplizerMapping;
|
protected final EntityModeToTuplizerMapping tuplizerMapping;
|
||||||
|
|
||||||
public ComponentType(ComponentMetamodel metamodel) {
|
public ComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
|
||||||
|
this.typeScope = typeScope;
|
||||||
// for now, just "re-flatten" the metamodel since this is temporary stuff anyway (HHH-1907)
|
// for now, just "re-flatten" the metamodel since this is temporary stuff anyway (HHH-1907)
|
||||||
this.isKey = metamodel.isKey();
|
this.isKey = metamodel.isKey();
|
||||||
this.propertySpan = metamodel.getPropertySpan();
|
this.propertySpan = metamodel.getPropertySpan();
|
||||||
|
@ -456,7 +458,7 @@ public class ComponentType extends AbstractType implements AbstractComponentType
|
||||||
: target;
|
: target;
|
||||||
|
|
||||||
final EntityMode entityMode = session.getEntityMode();
|
final EntityMode entityMode = session.getEntityMode();
|
||||||
Object[] values = TypeFactory.replace(
|
Object[] values = TypeHelper.replace(
|
||||||
getPropertyValues( original, entityMode ),
|
getPropertyValues( original, entityMode ),
|
||||||
getPropertyValues( result, entityMode ),
|
getPropertyValues( result, entityMode ),
|
||||||
propertyTypes,
|
propertyTypes,
|
||||||
|
@ -488,7 +490,7 @@ public class ComponentType extends AbstractType implements AbstractComponentType
|
||||||
target;
|
target;
|
||||||
|
|
||||||
final EntityMode entityMode = session.getEntityMode();
|
final EntityMode entityMode = session.getEntityMode();
|
||||||
Object[] values = TypeFactory.replace(
|
Object[] values = TypeHelper.replace(
|
||||||
getPropertyValues( original, entityMode ),
|
getPropertyValues( original, entityMode ),
|
||||||
getPropertyValues( result, entityMode ),
|
getPropertyValues( result, entityMode ),
|
||||||
propertyTypes,
|
propertyTypes,
|
||||||
|
|
|
@ -48,8 +48,13 @@ public class CustomCollectionType extends CollectionType {
|
||||||
private final UserCollectionType userType;
|
private final UserCollectionType userType;
|
||||||
private final boolean customLogging;
|
private final boolean customLogging;
|
||||||
|
|
||||||
public CustomCollectionType(Class userTypeClass, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
|
public CustomCollectionType(
|
||||||
super(role, foreignKeyPropertyName, isEmbeddedInXML);
|
TypeFactory.TypeScope typeScope,
|
||||||
|
Class userTypeClass,
|
||||||
|
String role,
|
||||||
|
String foreignKeyPropertyName,
|
||||||
|
boolean isEmbeddedInXML) {
|
||||||
|
super( typeScope, role, foreignKeyPropertyName, isEmbeddedInXML );
|
||||||
|
|
||||||
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() );
|
||||||
|
|
|
@ -40,8 +40,8 @@ public class EmbeddedComponentType extends ComponentType {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EmbeddedComponentType(ComponentMetamodel metamodel) {
|
public EmbeddedComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
|
||||||
super( metamodel );
|
super( typeScope, metamodel );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMethodOf(Method method) {
|
public boolean isMethodOf(Method method) {
|
||||||
|
|
|
@ -55,6 +55,7 @@ import org.hibernate.util.ReflectHelper;
|
||||||
*/
|
*/
|
||||||
public abstract class EntityType extends AbstractType implements AssociationType {
|
public abstract class EntityType extends AbstractType implements AssociationType {
|
||||||
|
|
||||||
|
private final TypeFactory.TypeScope scope;
|
||||||
private final String associatedEntityName;
|
private final String associatedEntityName;
|
||||||
protected final String uniqueKeyPropertyName;
|
protected final String uniqueKeyPropertyName;
|
||||||
protected final boolean isEmbeddedInXML;
|
protected final boolean isEmbeddedInXML;
|
||||||
|
@ -66,6 +67,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
/**
|
/**
|
||||||
* Constructs the requested entity type mapping.
|
* Constructs the requested entity type mapping.
|
||||||
*
|
*
|
||||||
|
* @param scope The type scope
|
||||||
* @param entityName The name of the associated entity.
|
* @param entityName The name of the associated entity.
|
||||||
* @param uniqueKeyPropertyName The property-ref name, or null if we
|
* @param uniqueKeyPropertyName The property-ref name, or null if we
|
||||||
* reference the PK of the associated entity.
|
* reference the PK of the associated entity.
|
||||||
|
@ -76,11 +78,13 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
* with lazy="no-proxy".
|
* with lazy="no-proxy".
|
||||||
*/
|
*/
|
||||||
protected EntityType(
|
protected EntityType(
|
||||||
|
TypeFactory.TypeScope scope,
|
||||||
String entityName,
|
String entityName,
|
||||||
String uniqueKeyPropertyName,
|
String uniqueKeyPropertyName,
|
||||||
boolean eager,
|
boolean eager,
|
||||||
boolean isEmbeddedInXML,
|
boolean isEmbeddedInXML,
|
||||||
boolean unwrapProxy) {
|
boolean unwrapProxy) {
|
||||||
|
this.scope = scope;
|
||||||
this.associatedEntityName = entityName;
|
this.associatedEntityName = entityName;
|
||||||
this.uniqueKeyPropertyName = uniqueKeyPropertyName;
|
this.uniqueKeyPropertyName = uniqueKeyPropertyName;
|
||||||
this.isEmbeddedInXML = isEmbeddedInXML;
|
this.isEmbeddedInXML = isEmbeddedInXML;
|
||||||
|
@ -88,6 +92,10 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
this.unwrapProxy = unwrapProxy;
|
this.unwrapProxy = unwrapProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected TypeFactory.TypeScope scope() {
|
||||||
|
return scope;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An entity type is a type of association type
|
* An entity type is a type of association type
|
||||||
*
|
*
|
||||||
|
|
|
@ -34,8 +34,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
||||||
|
|
||||||
public class IdentifierBagType extends CollectionType {
|
public class IdentifierBagType extends CollectionType {
|
||||||
|
|
||||||
public IdentifierBagType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||||
super(role, propertyRef, isEmbeddedInXML);
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersistentCollection instantiate(
|
public PersistentCollection instantiate(
|
||||||
|
|
|
@ -37,8 +37,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
||||||
|
|
||||||
public class ListType extends CollectionType {
|
public class ListType extends CollectionType {
|
||||||
|
|
||||||
public ListType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
public ListType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||||
super(role, propertyRef, isEmbeddedInXML);
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
|
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
|
||||||
|
|
|
@ -50,38 +50,27 @@ public class ManyToOneType extends EntityType {
|
||||||
/**
|
/**
|
||||||
* Creates a many-to-one association type with the given referenced entity.
|
* Creates a many-to-one association type with the given referenced entity.
|
||||||
*
|
*
|
||||||
|
* @param scope The scope for this instance.
|
||||||
* @param referencedEntityName The name iof the referenced entity
|
* @param referencedEntityName The name iof the referenced entity
|
||||||
*/
|
*/
|
||||||
public ManyToOneType(String referencedEntityName) {
|
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName) {
|
||||||
this( referencedEntityName, false );
|
this( scope, referencedEntityName, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a many-to-one association type with the given referenced entity and the
|
* Creates a many-to-one association type with the given referenced entity and the
|
||||||
* given laziness characteristic
|
* given laziness characteristic
|
||||||
*
|
*
|
||||||
|
* @param scope The scope for this instance.
|
||||||
* @param referencedEntityName The name iof the referenced entity
|
* @param referencedEntityName The name iof the referenced entity
|
||||||
* @param lazy Should the association be handled lazily
|
* @param lazy Should the association be handled lazily
|
||||||
*/
|
*/
|
||||||
public ManyToOneType(String referencedEntityName, boolean lazy) {
|
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean lazy) {
|
||||||
this( referencedEntityName, null, lazy, true, false, false );
|
this( scope, referencedEntityName, null, lazy, true, false, false, false );
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use {@link #ManyToOneType(String, String, boolean, boolean, boolean, boolean, boolean)}
|
|
||||||
* @noinspection JavaDoc
|
|
||||||
*/
|
|
||||||
public ManyToOneType(
|
|
||||||
String referencedEntityName,
|
|
||||||
String uniqueKeyPropertyName,
|
|
||||||
boolean lazy,
|
|
||||||
boolean unwrapProxy,
|
|
||||||
boolean isEmbeddedInXML,
|
|
||||||
boolean ignoreNotFound) {
|
|
||||||
this( referencedEntityName, uniqueKeyPropertyName, lazy, unwrapProxy, isEmbeddedInXML, ignoreNotFound, false );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManyToOneType(
|
public ManyToOneType(
|
||||||
|
TypeFactory.TypeScope scope,
|
||||||
String referencedEntityName,
|
String referencedEntityName,
|
||||||
String uniqueKeyPropertyName,
|
String uniqueKeyPropertyName,
|
||||||
boolean lazy,
|
boolean lazy,
|
||||||
|
@ -89,7 +78,7 @@ public class ManyToOneType extends EntityType {
|
||||||
boolean isEmbeddedInXML,
|
boolean isEmbeddedInXML,
|
||||||
boolean ignoreNotFound,
|
boolean ignoreNotFound,
|
||||||
boolean isLogicalOneToOne) {
|
boolean isLogicalOneToOne) {
|
||||||
super( referencedEntityName, uniqueKeyPropertyName, !lazy, isEmbeddedInXML, unwrapProxy );
|
super( scope, referencedEntityName, uniqueKeyPropertyName, !lazy, isEmbeddedInXML, unwrapProxy );
|
||||||
this.ignoreNotFound = ignoreNotFound;
|
this.ignoreNotFound = ignoreNotFound;
|
||||||
this.isLogicalOneToOne = isLogicalOneToOne;
|
this.isLogicalOneToOne = isLogicalOneToOne;
|
||||||
}
|
}
|
||||||
|
@ -162,17 +151,14 @@ public class ManyToOneType extends EntityType {
|
||||||
/**
|
/**
|
||||||
* Register the entity as batch loadable, if enabled
|
* Register the entity as batch loadable, if enabled
|
||||||
*/
|
*/
|
||||||
private void scheduleBatchLoadIfNeeded(
|
@SuppressWarnings({ "JavaDoc" })
|
||||||
Serializable id,
|
private void scheduleBatchLoadIfNeeded(Serializable id, SessionImplementor session) throws MappingException {
|
||||||
SessionImplementor session) throws MappingException {
|
|
||||||
//cannot batch fetch by unique key (property-ref associations)
|
//cannot batch fetch by unique key (property-ref associations)
|
||||||
if ( uniqueKeyPropertyName == null && id != null ) {
|
if ( uniqueKeyPropertyName == null && id != null ) {
|
||||||
EntityPersister persister = session.getFactory().getEntityPersister( getAssociatedEntityName() );
|
EntityPersister persister = session.getFactory().getEntityPersister( getAssociatedEntityName() );
|
||||||
EntityKey entityKey = new EntityKey( id, persister, session.getEntityMode() );
|
EntityKey entityKey = new EntityKey( id, persister, session.getEntityMode() );
|
||||||
if ( !session.getPersistenceContext().containsEntity( entityKey ) ) {
|
if ( !session.getPersistenceContext().containsEntity( entityKey ) ) {
|
||||||
session.getPersistenceContext()
|
session.getPersistenceContext().getBatchFetchQueue().addBatchLoadableEntityKey( entityKey );
|
||||||
.getBatchFetchQueue()
|
|
||||||
.addBatchLoadableEntityKey( entityKey );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
||||||
|
|
||||||
public class MapType extends CollectionType {
|
public class MapType extends CollectionType {
|
||||||
|
|
||||||
public MapType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
public MapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||||
super(role, propertyRef, isEmbeddedInXML);
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
|
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
|
||||||
|
|
|
@ -45,6 +45,22 @@ public class OneToOneType extends EntityType {
|
||||||
private final ForeignKeyDirection foreignKeyType;
|
private final ForeignKeyDirection foreignKeyType;
|
||||||
private final String propertyName;
|
private final String propertyName;
|
||||||
private final String entityName;
|
private final String entityName;
|
||||||
|
|
||||||
|
public OneToOneType(
|
||||||
|
TypeFactory.TypeScope scope,
|
||||||
|
String referencedEntityName,
|
||||||
|
ForeignKeyDirection foreignKeyType,
|
||||||
|
String uniqueKeyPropertyName,
|
||||||
|
boolean lazy,
|
||||||
|
boolean unwrapProxy,
|
||||||
|
boolean isEmbeddedInXML,
|
||||||
|
String entityName,
|
||||||
|
String propertyName) {
|
||||||
|
super( scope, referencedEntityName, uniqueKeyPropertyName, !lazy, isEmbeddedInXML, unwrapProxy );
|
||||||
|
this.foreignKeyType = foreignKeyType;
|
||||||
|
this.propertyName = propertyName;
|
||||||
|
this.entityName = entityName;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPropertyName() {
|
public String getPropertyName() {
|
||||||
return propertyName;
|
return propertyName;
|
||||||
|
@ -82,28 +98,6 @@ public class OneToOneType extends EntityType {
|
||||||
return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
|
return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OneToOneType(
|
|
||||||
String referencedEntityName,
|
|
||||||
ForeignKeyDirection foreignKeyType,
|
|
||||||
String uniqueKeyPropertyName,
|
|
||||||
boolean lazy,
|
|
||||||
boolean unwrapProxy,
|
|
||||||
boolean isEmbeddedInXML,
|
|
||||||
String entityName,
|
|
||||||
String propertyName
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
referencedEntityName,
|
|
||||||
uniqueKeyPropertyName,
|
|
||||||
!lazy,
|
|
||||||
isEmbeddedInXML,
|
|
||||||
unwrapProxy
|
|
||||||
);
|
|
||||||
this.foreignKeyType = foreignKeyType;
|
|
||||||
this.propertyName = propertyName;
|
|
||||||
this.entityName = entityName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SessionImplementor session) {
|
public void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable, SessionImplementor session) {
|
||||||
//nothing to do
|
//nothing to do
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ public class OrderedMapType extends MapType {
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
public OrderedMapType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||||
super( role, propertyRef, isEmbeddedInXML );
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,12 +34,13 @@ public class OrderedSetType extends SetType {
|
||||||
* Constructs a set type capable of creating ordered sets of the given
|
* Constructs a set type capable of creating ordered sets of the given
|
||||||
* role.
|
* role.
|
||||||
*
|
*
|
||||||
|
* @param typeScope The scope for this type instance.
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
public OrderedSetType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||||
super( role, propertyRef, isEmbeddedInXML );
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -36,8 +36,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
||||||
|
|
||||||
public class SetType extends CollectionType {
|
public class SetType extends CollectionType {
|
||||||
|
|
||||||
public SetType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||||
super(role, propertyRef, isEmbeddedInXML);
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
}
|
}
|
||||||
|
|
||||||
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
|
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
|
||||||
|
|
|
@ -41,8 +41,8 @@ public class SortedMapType extends MapType {
|
||||||
|
|
||||||
private final Comparator comparator;
|
private final Comparator comparator;
|
||||||
|
|
||||||
public SortedMapType(String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
|
public SortedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
|
||||||
super(role, propertyRef, isEmbeddedInXML);
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ public class SortedSetType extends SetType {
|
||||||
|
|
||||||
private final Comparator comparator;
|
private final Comparator comparator;
|
||||||
|
|
||||||
public SortedSetType(String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
|
public SortedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
|
||||||
super(role, propertyRef, isEmbeddedInXML);
|
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||||
this.comparator = comparator;
|
this.comparator = comparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,15 +43,16 @@ import org.hibernate.engine.SessionImplementor;
|
||||||
public class SpecialOneToOneType extends OneToOneType {
|
public class SpecialOneToOneType extends OneToOneType {
|
||||||
|
|
||||||
public SpecialOneToOneType(
|
public SpecialOneToOneType(
|
||||||
|
TypeFactory.TypeScope scope,
|
||||||
String referencedEntityName,
|
String referencedEntityName,
|
||||||
ForeignKeyDirection foreignKeyType,
|
ForeignKeyDirection foreignKeyType,
|
||||||
String uniqueKeyPropertyName,
|
String uniqueKeyPropertyName,
|
||||||
boolean lazy,
|
boolean lazy,
|
||||||
boolean unwrapProxy,
|
boolean unwrapProxy,
|
||||||
String entityName,
|
String entityName,
|
||||||
String propertyName
|
String propertyName) {
|
||||||
) {
|
|
||||||
super(
|
super(
|
||||||
|
scope,
|
||||||
referencedEntityName,
|
referencedEntityName,
|
||||||
foreignKeyType,
|
foreignKeyType,
|
||||||
uniqueKeyPropertyName,
|
uniqueKeyPropertyName,
|
||||||
|
|
|
@ -25,7 +25,6 @@ package org.hibernate.type;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -34,15 +33,18 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.MappingException;
|
import org.hibernate.MappingException;
|
||||||
import org.hibernate.classic.Lifecycle;
|
import org.hibernate.classic.Lifecycle;
|
||||||
|
import org.hibernate.classic.Validatable;
|
||||||
import org.hibernate.engine.SessionFactoryImplementor;
|
import org.hibernate.engine.SessionFactoryImplementor;
|
||||||
import org.hibernate.engine.SessionImplementor;
|
import org.hibernate.tuple.component.ComponentMetamodel;
|
||||||
import org.hibernate.tuple.StandardProperty;
|
|
||||||
import org.hibernate.usertype.CompositeUserType;
|
import org.hibernate.usertype.CompositeUserType;
|
||||||
import org.hibernate.usertype.ParameterizedType;
|
import org.hibernate.usertype.ParameterizedType;
|
||||||
import org.hibernate.usertype.UserType;
|
import org.hibernate.usertype.UserType;
|
||||||
import org.hibernate.util.ReflectHelper;
|
import org.hibernate.util.ReflectHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Used internally to build instances of {@link Type}, specifically it builds instances of
|
||||||
|
*
|
||||||
|
*
|
||||||
* Used internally to obtain instances of <tt>Type</tt>. Applications should use static methods
|
* Used internally to obtain instances of <tt>Type</tt>. Applications should use static methods
|
||||||
* and constants on <tt>org.hibernate.Hibernate</tt>.
|
* and constants on <tt>org.hibernate.Hibernate</tt>.
|
||||||
*
|
*
|
||||||
|
@ -97,9 +99,9 @@ public final class TypeFactory implements Serializable {
|
||||||
return custom( (Class<UserType>) clazz, parameters );
|
return custom( (Class<UserType>) clazz, parameters );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Lifecycle.class.isAssignableFrom( clazz ) ) {
|
if ( Lifecycle.class.isAssignableFrom( clazz ) || Validatable.class.isAssignableFrom( clazz ) ) {
|
||||||
// not really a many-to-one association *necessarily*
|
// not really a many-to-one association *necessarily*
|
||||||
return new ManyToOneType( clazz.getName() );
|
return manyToOne( clazz.getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Serializable.class.isAssignableFrom( clazz ) ) {
|
if ( Serializable.class.isAssignableFrom( clazz ) ) {
|
||||||
|
@ -120,7 +122,7 @@ public final class TypeFactory implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void injectParameters(Object type, Properties parameters) {
|
public void injectParameters(Object type, Properties parameters) {
|
||||||
if ( ParameterizedType.class.isInstance( type ) ) {
|
if ( ParameterizedType.class.isInstance( type ) ) {
|
||||||
( (ParameterizedType) type ).setParameterValues(parameters);
|
( (ParameterizedType) type ).setParameterValues(parameters);
|
||||||
}
|
}
|
||||||
|
@ -129,7 +131,7 @@ public final class TypeFactory implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CompositeCustomType customComponent(Class<CompositeUserType> typeClass, Properties parameters) {
|
public CompositeCustomType customComponent(Class<CompositeUserType> typeClass, Properties parameters) {
|
||||||
try {
|
try {
|
||||||
CompositeUserType userType = typeClass.newInstance();
|
CompositeUserType userType = typeClass.newInstance();
|
||||||
injectParameters( userType, parameters );
|
injectParameters( userType, parameters );
|
||||||
|
@ -140,7 +142,27 @@ public final class TypeFactory implements Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CustomType custom(Class<UserType> typeClass, Properties parameters) {
|
public CollectionType customCollection(
|
||||||
|
String typeName,
|
||||||
|
Properties typeParameters,
|
||||||
|
String role,
|
||||||
|
String propertyRef,
|
||||||
|
boolean embedded) {
|
||||||
|
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, embedded );
|
||||||
|
if ( typeParameters != null ) {
|
||||||
|
injectParameters( result.getUserType(), typeParameters );
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CustomType custom(Class<UserType> typeClass, Properties parameters) {
|
||||||
try {
|
try {
|
||||||
UserType userType = typeClass.newInstance();
|
UserType userType = typeClass.newInstance();
|
||||||
injectParameters( userType, parameters );
|
injectParameters( userType, parameters );
|
||||||
|
@ -164,10 +186,9 @@ public final class TypeFactory implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
// one-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
* A one-to-one association type for the given class
|
|
||||||
*/
|
public EntityType oneToOne(
|
||||||
public static EntityType oneToOne(
|
|
||||||
String persistentClass,
|
String persistentClass,
|
||||||
ForeignKeyDirection foreignKeyType,
|
ForeignKeyDirection foreignKeyType,
|
||||||
String uniqueKeyPropertyName,
|
String uniqueKeyPropertyName,
|
||||||
|
@ -175,61 +196,35 @@ public final class TypeFactory implements Serializable {
|
||||||
boolean unwrapProxy,
|
boolean unwrapProxy,
|
||||||
boolean isEmbeddedInXML,
|
boolean isEmbeddedInXML,
|
||||||
String entityName,
|
String entityName,
|
||||||
String propertyName
|
String propertyName) {
|
||||||
) {
|
return new OneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName,
|
||||||
return new OneToOneType(
|
lazy, unwrapProxy, isEmbeddedInXML, entityName, propertyName );
|
||||||
persistentClass,
|
|
||||||
foreignKeyType,
|
|
||||||
uniqueKeyPropertyName,
|
|
||||||
lazy,
|
|
||||||
unwrapProxy,
|
|
||||||
isEmbeddedInXML,
|
|
||||||
entityName,
|
|
||||||
propertyName
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public EntityType specialOneToOne(
|
||||||
* A many-to-one association type for the given class
|
|
||||||
*/
|
|
||||||
public static EntityType manyToOne(String persistentClass) {
|
|
||||||
return new ManyToOneType( persistentClass );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A many-to-one association type for the given class
|
|
||||||
*/
|
|
||||||
public static EntityType manyToOne(String persistentClass, boolean lazy) {
|
|
||||||
return new ManyToOneType( persistentClass, lazy );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A many-to-one association type for the given class
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #manyToOne(String, String, boolean, boolean, boolean, boolean, boolean)}
|
|
||||||
*/
|
|
||||||
public static EntityType manyToOne(
|
|
||||||
String persistentClass,
|
String persistentClass,
|
||||||
|
ForeignKeyDirection foreignKeyType,
|
||||||
String uniqueKeyPropertyName,
|
String uniqueKeyPropertyName,
|
||||||
boolean lazy,
|
boolean lazy,
|
||||||
boolean unwrapProxy,
|
boolean unwrapProxy,
|
||||||
boolean isEmbeddedInXML,
|
String entityName,
|
||||||
boolean ignoreNotFound) {
|
String propertyName) {
|
||||||
//noinspection deprecation
|
return new SpecialOneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName,
|
||||||
return new ManyToOneType(
|
lazy, unwrapProxy, entityName, propertyName );
|
||||||
persistentClass,
|
|
||||||
uniqueKeyPropertyName,
|
|
||||||
lazy,
|
|
||||||
unwrapProxy,
|
|
||||||
isEmbeddedInXML,
|
|
||||||
ignoreNotFound
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* A many-to-one association type for the given class
|
// many-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
*/
|
|
||||||
public static EntityType manyToOne(
|
public EntityType manyToOne(String persistentClass) {
|
||||||
|
return new ManyToOneType( typeScope, persistentClass );
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityType manyToOne(String persistentClass, boolean lazy) {
|
||||||
|
return new ManyToOneType( typeScope, persistentClass, lazy );
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityType manyToOne(
|
||||||
String persistentClass,
|
String persistentClass,
|
||||||
String uniqueKeyPropertyName,
|
String uniqueKeyPropertyName,
|
||||||
boolean lazy,
|
boolean lazy,
|
||||||
|
@ -238,6 +233,7 @@ public final class TypeFactory implements Serializable {
|
||||||
boolean ignoreNotFound,
|
boolean ignoreNotFound,
|
||||||
boolean isLogicalOneToOne) {
|
boolean isLogicalOneToOne) {
|
||||||
return new ManyToOneType(
|
return new ManyToOneType(
|
||||||
|
typeScope,
|
||||||
persistentClass,
|
persistentClass,
|
||||||
uniqueKeyPropertyName,
|
uniqueKeyPropertyName,
|
||||||
lazy,
|
lazy,
|
||||||
|
@ -248,299 +244,64 @@ public final class TypeFactory implements Serializable {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The legacy contract.
|
// collection type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
*
|
|
||||||
* @deprecated Use {@link #customCollection(String, java.util.Properties, String, String, boolean)} instead
|
public CollectionType array(String role, String propertyRef, boolean embedded, Class elementClass) {
|
||||||
*/
|
return new ArrayType( typeScope, role, propertyRef, elementClass, embedded );
|
||||||
public static CollectionType customCollection(
|
|
||||||
String typeName,
|
|
||||||
String role,
|
|
||||||
String propertyRef,
|
|
||||||
boolean embedded) {
|
|
||||||
return customCollection( typeName, null, role, propertyRef, embedded );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CollectionType customCollection(
|
public CollectionType list(String role, String propertyRef, boolean embedded) {
|
||||||
String typeName,
|
return new ListType( typeScope, role, propertyRef, embedded );
|
||||||
Properties typeParameters,
|
|
||||||
String role,
|
|
||||||
String propertyRef,
|
|
||||||
boolean embedded) {
|
|
||||||
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( typeClass, role, propertyRef, embedded );
|
|
||||||
if ( typeParameters != null ) {
|
|
||||||
TypeFactory.injectParameters( result.getUserType(), typeParameters );
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collection Types:
|
public CollectionType bag(String role, String propertyRef, boolean embedded) {
|
||||||
|
return new BagType( typeScope, role, propertyRef, embedded );
|
||||||
public static CollectionType array(String role, String propertyRef, boolean embedded,
|
|
||||||
Class elementClass) {
|
|
||||||
return new ArrayType( role, propertyRef, elementClass, embedded );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CollectionType list(String role, String propertyRef, boolean embedded) {
|
public CollectionType idbag(String role, String propertyRef, boolean embedded) {
|
||||||
return new ListType( role, propertyRef, embedded );
|
return new IdentifierBagType( typeScope, role, propertyRef, embedded );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CollectionType bag(String role, String propertyRef, boolean embedded) {
|
public CollectionType map(String role, String propertyRef, boolean embedded) {
|
||||||
return new BagType( role, propertyRef, embedded );
|
return new MapType( typeScope, role, propertyRef, embedded );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CollectionType idbag(String role, String propertyRef, boolean embedded) {
|
public CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
|
||||||
return new IdentifierBagType( role, propertyRef, embedded );
|
return new OrderedMapType( typeScope, role, propertyRef, embedded );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CollectionType map(String role, String propertyRef, boolean embedded) {
|
public CollectionType sortedMap(String role, String propertyRef, boolean embedded, Comparator comparator) {
|
||||||
return new MapType( role, propertyRef, embedded );
|
return new SortedMapType( typeScope, role, propertyRef, comparator, embedded );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
|
public CollectionType set(String role, String propertyRef, boolean embedded) {
|
||||||
return new OrderedMapType( role, propertyRef, embedded );
|
return new SetType( typeScope, role, propertyRef, embedded );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CollectionType set(String role, String propertyRef, boolean embedded) {
|
public CollectionType orderedSet(String role, String propertyRef, boolean embedded) {
|
||||||
return new SetType( role, propertyRef, embedded );
|
return new OrderedSetType( typeScope, role, propertyRef, embedded );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CollectionType orderedSet(String role, String propertyRef, boolean embedded) {
|
public CollectionType sortedSet(String role, String propertyRef, boolean embedded, Comparator comparator) {
|
||||||
return new OrderedSetType( role, propertyRef, embedded );
|
return new SortedSetType( typeScope, role, propertyRef, comparator, embedded );
|
||||||
}
|
|
||||||
|
|
||||||
public static CollectionType sortedMap(String role, String propertyRef, boolean embedded,
|
|
||||||
Comparator comparator) {
|
|
||||||
return new SortedMapType( role, propertyRef, comparator, embedded );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CollectionType sortedSet(String role, String propertyRef, boolean embedded,
|
|
||||||
Comparator comparator) {
|
|
||||||
return new SortedSetType( role, propertyRef, comparator, embedded );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// convenience methods relating to operations across arrays of types ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// component type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
/**
|
public ComponentType component(ComponentMetamodel metamodel) {
|
||||||
* Deep copy a series of values from one array to another...
|
return new ComponentType( typeScope, metamodel );
|
||||||
*
|
|
||||||
* @param values The values to copy (the source)
|
|
||||||
* @param types The value types
|
|
||||||
* @param copy an array indicating which values to include in the copy
|
|
||||||
* @param target The array into which to copy the values
|
|
||||||
* @param session The originating session
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#deepCopy} instead
|
|
||||||
*/
|
|
||||||
public static void deepCopy(
|
|
||||||
final Object[] values,
|
|
||||||
final Type[] types,
|
|
||||||
final boolean[] copy,
|
|
||||||
final Object[] target,
|
|
||||||
final SessionImplementor session) {
|
|
||||||
TypeHelper.deepCopy( values, types, copy, target, session );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public EmbeddedComponentType embeddedComponent(ComponentMetamodel metamodel) {
|
||||||
* Apply the {@link Type#beforeAssemble} operation across a series of values.
|
return new EmbeddedComponentType( typeScope, metamodel );
|
||||||
*
|
|
||||||
* @param row The values
|
|
||||||
* @param types The value types
|
|
||||||
* @param session The originating session
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#beforeAssemble} instead
|
|
||||||
*/
|
|
||||||
public static void beforeAssemble(
|
|
||||||
final Serializable[] row,
|
|
||||||
final Type[] types,
|
|
||||||
final SessionImplementor session) {
|
|
||||||
TypeHelper.beforeAssemble( row, types, session );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply the {@link Type#assemble} operation across a series of values.
|
|
||||||
*
|
|
||||||
* @param row The values
|
|
||||||
* @param types The value types
|
|
||||||
* @param session The originating session
|
|
||||||
* @param owner The entity "owning" the values
|
|
||||||
*
|
|
||||||
* @return The assembled state
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#assemble} instead
|
|
||||||
*/
|
|
||||||
public static Object[] assemble(
|
|
||||||
final Serializable[] row,
|
|
||||||
final Type[] types,
|
|
||||||
final SessionImplementor session,
|
|
||||||
final Object owner) {
|
|
||||||
return TypeHelper.assemble( row, types, session, owner );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
// any type builder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
* Apply the {@link Type#disassemble} operation across a series of values.
|
|
||||||
*
|
|
||||||
* @param row The values
|
|
||||||
* @param types The value types
|
|
||||||
* @param nonCacheable An array indicating which values to include in the disassembled state
|
|
||||||
* @param session The originating session
|
|
||||||
* @param owner The entity "owning" the values
|
|
||||||
*
|
|
||||||
* @return The disassembled state
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#disassemble} instead
|
|
||||||
*/
|
|
||||||
public static Serializable[] disassemble(
|
|
||||||
final Object[] row,
|
|
||||||
final Type[] types,
|
|
||||||
final boolean[] nonCacheable,
|
|
||||||
final SessionImplementor session,
|
|
||||||
final Object owner) {
|
|
||||||
return TypeHelper.disassemble( row, types, nonCacheable, session, owner );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public Type any(Type metaType, Type identifierType) {
|
||||||
* Apply the {@link Type#replace} operation across a series of values.
|
return new AnyType( metaType, identifierType );
|
||||||
*
|
|
||||||
* @param original The source of the state
|
|
||||||
* @param target The target into which to replace the source values.
|
|
||||||
* @param types The value types
|
|
||||||
* @param session The originating session
|
|
||||||
* @param owner The entity "owning" the values
|
|
||||||
* @param copyCache A map representing a cache of already replaced state
|
|
||||||
*
|
|
||||||
* @return The replaced state
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#replace} instead
|
|
||||||
*/
|
|
||||||
public static Object[] replace(
|
|
||||||
final Object[] original,
|
|
||||||
final Object[] target,
|
|
||||||
final Type[] types,
|
|
||||||
final SessionImplementor session,
|
|
||||||
final Object owner,
|
|
||||||
final Map copyCache) {
|
|
||||||
return TypeHelper.replace( original, target, types, session, owner, copyCache );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply the {@link Type#replace} operation across a series of values.
|
|
||||||
*
|
|
||||||
* @param original The source of the state
|
|
||||||
* @param target The target into which to replace the source values.
|
|
||||||
* @param types The value types
|
|
||||||
* @param session The originating session
|
|
||||||
* @param owner The entity "owning" the values
|
|
||||||
* @param copyCache A map representing a cache of already replaced state
|
|
||||||
* @param foreignKeyDirection FK directionality to be applied to the replacement
|
|
||||||
*
|
|
||||||
* @return The replaced state
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#replace} instead
|
|
||||||
*/
|
|
||||||
public static Object[] replace(
|
|
||||||
final Object[] original,
|
|
||||||
final Object[] target,
|
|
||||||
final Type[] types,
|
|
||||||
final SessionImplementor session,
|
|
||||||
final Object owner,
|
|
||||||
final Map copyCache,
|
|
||||||
final ForeignKeyDirection foreignKeyDirection) {
|
|
||||||
return TypeHelper.replace( original, target, types, session, owner, copyCache, foreignKeyDirection );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply the {@link Type#replace} operation across a series of values, as
|
|
||||||
* long as the corresponding {@link Type} is an association.
|
|
||||||
* <p/>
|
|
||||||
* If the corresponding type is a component type, then apply {@link Type#replace}
|
|
||||||
* across the component subtypes but do not replace the component value itself.
|
|
||||||
*
|
|
||||||
* @param original The source of the state
|
|
||||||
* @param target The target into which to replace the source values.
|
|
||||||
* @param types The value types
|
|
||||||
* @param session The originating session
|
|
||||||
* @param owner The entity "owning" the values
|
|
||||||
* @param copyCache A map representing a cache of already replaced state
|
|
||||||
* @param foreignKeyDirection FK directionality to be applied to the replacement
|
|
||||||
*
|
|
||||||
* @return The replaced state
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#replaceAssociations} instead
|
|
||||||
*/
|
|
||||||
public static Object[] replaceAssociations(
|
|
||||||
final Object[] original,
|
|
||||||
final Object[] target,
|
|
||||||
final Type[] types,
|
|
||||||
final SessionImplementor session,
|
|
||||||
final Object owner,
|
|
||||||
final Map copyCache,
|
|
||||||
final ForeignKeyDirection foreignKeyDirection) {
|
|
||||||
return TypeHelper.replaceAssociations( original, target, types, session, owner, copyCache, foreignKeyDirection );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if any of the given field values are dirty, returning an array containing
|
|
||||||
* indices of the dirty fields.
|
|
||||||
* <p/>
|
|
||||||
* If it is determined that no fields are dirty, null is returned.
|
|
||||||
*
|
|
||||||
* @param properties The property definitions
|
|
||||||
* @param currentState The current state of the entity
|
|
||||||
* @param previousState The baseline state of the entity
|
|
||||||
* @param includeColumns Columns to be included in the dirty checking, per property
|
|
||||||
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
|
|
||||||
* @param session The session from which the dirty check request originated.
|
|
||||||
*
|
|
||||||
* @return Array containing indices of the dirty properties, or null if no properties considered dirty.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#findDirty} instead
|
|
||||||
*/
|
|
||||||
public static int[] findDirty(
|
|
||||||
final StandardProperty[] properties,
|
|
||||||
final Object[] currentState,
|
|
||||||
final Object[] previousState,
|
|
||||||
final boolean[][] includeColumns,
|
|
||||||
final boolean anyUninitializedProperties,
|
|
||||||
final SessionImplementor session) {
|
|
||||||
return TypeHelper.findDirty( properties, currentState, previousState,
|
|
||||||
includeColumns, anyUninitializedProperties, session );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determine if any of the given field values are modified, returning an array containing
|
|
||||||
* indices of the modified fields.
|
|
||||||
* <p/>
|
|
||||||
* If it is determined that no fields are dirty, null is returned.
|
|
||||||
*
|
|
||||||
* @param properties The property definitions
|
|
||||||
* @param currentState The current state of the entity
|
|
||||||
* @param previousState The baseline state of the entity
|
|
||||||
* @param includeColumns Columns to be included in the mod checking, per property
|
|
||||||
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
|
|
||||||
* @param session The session from which the dirty check request originated.
|
|
||||||
*
|
|
||||||
* @return Array containing indices of the modified properties, or null if no properties considered modified.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link TypeHelper#findModified} instead
|
|
||||||
*/
|
|
||||||
public static int[] findModified(
|
|
||||||
final StandardProperty[] properties,
|
|
||||||
final Object[] currentState,
|
|
||||||
final Object[] previousState,
|
|
||||||
final boolean[][] includeColumns,
|
|
||||||
final boolean anyUninitializedProperties,
|
|
||||||
final SessionImplementor session) {
|
|
||||||
return TypeHelper.findModified( properties, currentState, previousState,
|
|
||||||
includeColumns, anyUninitializedProperties, session );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,9 +122,10 @@ public class TypeHelper {
|
||||||
*
|
*
|
||||||
* @param row The values
|
* @param row The values
|
||||||
* @param types The value types
|
* @param types The value types
|
||||||
* @param nonCacheable An array indicating which values to include in the disassemled state
|
* @param nonCacheable An array indicating which values to include in the disassembled state
|
||||||
* @param session The originating session
|
* @param session The originating session
|
||||||
* @param owner The entity "owning" the values
|
* @param owner The entity "owning" the values
|
||||||
|
*
|
||||||
* @return The disassembled state
|
* @return The disassembled state
|
||||||
*/
|
*/
|
||||||
public static Serializable[] disassemble(
|
public static Serializable[] disassemble(
|
||||||
|
@ -157,6 +158,7 @@ public class TypeHelper {
|
||||||
* @param session The originating session
|
* @param session The originating session
|
||||||
* @param owner The entity "owning" the values
|
* @param owner The entity "owning" the values
|
||||||
* @param copyCache A map representing a cache of already replaced state
|
* @param copyCache A map representing a cache of already replaced state
|
||||||
|
*
|
||||||
* @return The replaced state
|
* @return The replaced state
|
||||||
*/
|
*/
|
||||||
public static Object[] replace(
|
public static Object[] replace(
|
||||||
|
@ -189,6 +191,7 @@ public class TypeHelper {
|
||||||
* @param owner The entity "owning" the values
|
* @param owner The entity "owning" the values
|
||||||
* @param copyCache A map representing a cache of already replaced state
|
* @param copyCache A map representing a cache of already replaced state
|
||||||
* @param foreignKeyDirection FK directionality to be applied to the replacement
|
* @param foreignKeyDirection FK directionality to be applied to the replacement
|
||||||
|
*
|
||||||
* @return The replaced state
|
* @return The replaced state
|
||||||
*/
|
*/
|
||||||
public static Object[] replace(
|
public static Object[] replace(
|
||||||
|
@ -213,11 +216,11 @@ public class TypeHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the {@link Type#replace} operation across a series of values, as
|
* Apply the {@link Type#replace} operation across a series of values, as long as the corresponding
|
||||||
* long as the corresponding {@link Type} is an association.
|
* {@link Type} is an association.
|
||||||
* <p/>
|
* <p/>
|
||||||
* If the corresponding type is a component type, then apply {@link Type#replace}
|
* If the corresponding type is a component type, then apply {@link Type#replace} across the component
|
||||||
* across the component subtypes but do not replace the component value itself.
|
* subtypes but do not replace the component value itself.
|
||||||
*
|
*
|
||||||
* @param original The source of the state
|
* @param original The source of the state
|
||||||
* @param target The target into which to replace the source values.
|
* @param target The target into which to replace the source values.
|
||||||
|
@ -274,6 +277,7 @@ public class TypeHelper {
|
||||||
* @param includeColumns Columns to be included in the dirty checking, per property
|
* @param includeColumns Columns to be included in the dirty checking, per property
|
||||||
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
|
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
|
||||||
* @param session The session from which the dirty check request originated.
|
* @param session The session from which the dirty check request originated.
|
||||||
|
*
|
||||||
* @return Array containing indices of the dirty properties, or null if no properties considered dirty.
|
* @return Array containing indices of the dirty properties, or null if no properties considered dirty.
|
||||||
*/
|
*/
|
||||||
public static int[] findDirty(
|
public static int[] findDirty(
|
||||||
|
@ -321,6 +325,7 @@ public class TypeHelper {
|
||||||
* @param includeColumns Columns to be included in the mod checking, per property
|
* @param includeColumns Columns to be included in the mod checking, per property
|
||||||
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
|
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
|
||||||
* @param session The session from which the dirty check request originated.
|
* @param session The session from which the dirty check request originated.
|
||||||
|
*
|
||||||
* @return Array containing indices of the modified properties, or null if no properties considered modified.
|
* @return Array containing indices of the modified properties, or null if no properties considered modified.
|
||||||
*/
|
*/
|
||||||
public static int[] findModified(
|
public static int[] findModified(
|
||||||
|
|
|
@ -56,8 +56,16 @@ public class TypeResolver implements Serializable {
|
||||||
return new TypeResolver( basicTypeRegistry.shallowCopy(), typeFactory );
|
return new TypeResolver( basicTypeRegistry.shallowCopy(), typeFactory );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void registerTypeOverride(BasicType type) {
|
||||||
|
basicTypeRegistry.register( type );
|
||||||
|
}
|
||||||
|
|
||||||
|
public TypeFactory getTypeFactory() {
|
||||||
|
return typeFactory;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locate a Hibernate {@linkplain BasicType basic type} given (one of) its registration name(s).
|
* Locate a Hibernate {@linkplain BasicType basic type} given (one of) its registration names.
|
||||||
*
|
*
|
||||||
* @param name The registration name
|
* @param name The registration name
|
||||||
*
|
*
|
||||||
|
|
|
@ -178,19 +178,19 @@ public class ValueVisitorTest extends UnitTestCase {
|
||||||
|
|
||||||
ValueVisitor vv = new ValueVisitorValidator();
|
ValueVisitor vv = new ValueVisitorValidator();
|
||||||
|
|
||||||
new Any(mappings, tbl).accept(vv);
|
new Any( mappings, tbl ).accept(vv);
|
||||||
new Array( rootClass ).accept(vv);
|
new Array( mappings, rootClass ).accept(vv);
|
||||||
new Bag( rootClass ).accept(vv);
|
new Bag( mappings, rootClass ).accept(vv);
|
||||||
new Component( mappings, rootClass ).accept(vv);
|
new Component( mappings, rootClass ).accept(vv);
|
||||||
new DependantValue( mappings, tbl, null ).accept(vv);
|
new DependantValue( mappings, tbl, null ).accept(vv);
|
||||||
new IdentifierBag( rootClass ).accept(vv);
|
new IdentifierBag( mappings, rootClass ).accept(vv);
|
||||||
new List( rootClass ).accept(vv);
|
new List( mappings, rootClass ).accept(vv);
|
||||||
new ManyToOne( mappings, tbl ).accept(vv);
|
new ManyToOne( mappings, tbl ).accept(vv);
|
||||||
new Map( rootClass ).accept(vv);
|
new Map( mappings, rootClass ).accept(vv);
|
||||||
new OneToMany( rootClass ).accept(vv);
|
new OneToMany( mappings, rootClass ).accept(vv);
|
||||||
new OneToOne( mappings, tbl, rootClass ).accept(vv);
|
new OneToOne( mappings, tbl, rootClass ).accept(vv);
|
||||||
new PrimitiveArray( rootClass ).accept(vv);
|
new PrimitiveArray( mappings, rootClass ).accept(vv);
|
||||||
new Set( rootClass ).accept(vv);
|
new Set( mappings, rootClass ).accept(vv);
|
||||||
new SimpleValue( mappings ).accept(vv);
|
new SimpleValue( mappings ).accept(vv);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue