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) {
|
||||
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 boolean hibernateExtensionMapping;
|
||||
|
||||
protected ExtendedMappings getMappings() {
|
||||
return mappings;
|
||||
}
|
||||
|
||||
public boolean isMap() {
|
||||
return false;
|
||||
}
|
||||
|
@ -700,7 +704,7 @@ public abstract class CollectionBinder {
|
|||
) {
|
||||
|
||||
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 );
|
||||
oneToMany.setReferencedEntityName( collectionType.getName() );
|
||||
oneToMany.setIgnoreNotFound( ignoreNotFound );
|
||||
|
|
|
@ -26,7 +26,6 @@ package org.hibernate;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.Serializable;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.sql.Blob;
|
||||
import java.sql.Clob;
|
||||
|
@ -44,7 +43,6 @@ import org.hibernate.intercept.FieldInterceptionHelper;
|
|||
import org.hibernate.intercept.FieldInterceptor;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.proxy.LazyInitializer;
|
||||
import org.hibernate.type.AnyType;
|
||||
import org.hibernate.type.BigDecimalType;
|
||||
import org.hibernate.type.BigIntegerType;
|
||||
import org.hibernate.type.BinaryType;
|
||||
|
@ -56,16 +54,13 @@ import org.hibernate.type.CalendarType;
|
|||
import org.hibernate.type.CharacterType;
|
||||
import org.hibernate.type.ClassType;
|
||||
import org.hibernate.type.ClobType;
|
||||
import org.hibernate.type.CompositeCustomType;
|
||||
import org.hibernate.type.CurrencyType;
|
||||
import org.hibernate.type.CustomType;
|
||||
import org.hibernate.type.DateType;
|
||||
import org.hibernate.type.DoubleType;
|
||||
import org.hibernate.type.FloatType;
|
||||
import org.hibernate.type.IntegerType;
|
||||
import org.hibernate.type.LocaleType;
|
||||
import org.hibernate.type.LongType;
|
||||
import org.hibernate.type.ManyToOneType;
|
||||
import org.hibernate.type.ObjectType;
|
||||
import org.hibernate.type.SerializableType;
|
||||
import org.hibernate.type.ShortType;
|
||||
|
@ -76,7 +71,6 @@ import org.hibernate.type.TimeZoneType;
|
|||
import org.hibernate.type.TimestampType;
|
||||
import org.hibernate.type.TrueFalseType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.type.YesNoType;
|
||||
import org.hibernate.type.CharArrayType;
|
||||
import org.hibernate.type.WrapperBinaryType;
|
||||
|
@ -84,7 +78,6 @@ import org.hibernate.type.CharacterArrayType;
|
|||
import org.hibernate.type.MaterializedBlobType;
|
||||
import org.hibernate.type.ImageType;
|
||||
import org.hibernate.type.MaterializedClobType;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
|
||||
/**
|
||||
* <ul>
|
||||
|
@ -281,83 +274,76 @@ public final class Hibernate {
|
|||
|
||||
/**
|
||||
* A Hibernate <tt>serializable</tt> type.
|
||||
*
|
||||
* @param serializableClass The {@link java.io.Serializable} implementor class.
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @deprecated Use {@link SerializableType#SerializableType} instead.
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public static Type serializable(Class 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
|
||||
* @param identifierType the entity identifier type
|
||||
* @return the Type
|
||||
* @deprecated Use {@link TypeHelper#any} instead.
|
||||
*/
|
||||
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||
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) {
|
||||
// not really a many-to-one association *necessarily*
|
||||
return new ManyToOneType( persistentClass.getName() );
|
||||
throw new HibernateException( "Not supported" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
// not really a many-to-one association *necessarily*
|
||||
return new ManyToOneType( entityName );
|
||||
throw new HibernateException( "Not supported" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 {
|
||||
return custom( userTypeClass, null );
|
||||
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||
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>
|
||||
* @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.
|
||||
* @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
|
||||
*/
|
||||
public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues)
|
||||
throws HibernateException {
|
||||
Properties parameters = new Properties();
|
||||
for ( int i = 0; i < parameterNames.length; i++ ) {
|
||||
parameters.setProperty( parameterNames[i], parameterValues[i] );
|
||||
}
|
||||
return custom( userTypeClass, parameters );
|
||||
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||
public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues) {
|
||||
throw new HibernateException( "Not supported" );
|
||||
}
|
||||
|
||||
/**
|
||||
* A Hibernate parameterizable custom type.
|
||||
* DO NOT USE!
|
||||
*
|
||||
* @param userTypeClass a class that implements <tt>UserType and ParameterizableType</tt>
|
||||
* @param parameters the parameters as a collection of name/value pairs
|
||||
* @deprecated Use {@link TypeHelper#custom} instead; see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
|
||||
*/
|
||||
public static Type custom(Class userTypeClass, Properties parameters)
|
||||
throws HibernateException {
|
||||
if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
|
||||
return TypeFactory.customComponent( userTypeClass, parameters );
|
||||
}
|
||||
else {
|
||||
return TypeFactory.custom( userTypeClass, parameters );
|
||||
}
|
||||
@SuppressWarnings({ "JavaDoc", "UnusedDeclaration" })
|
||||
public static Type custom(Class userTypeClass, Properties parameters) {
|
||||
throw new HibernateException( "Not supported" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -995,20 +995,26 @@ public interface Session extends Serializable {
|
|||
*/
|
||||
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).
|
||||
*
|
||||
*/
|
||||
public interface LockRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Contains locking details (LockMode, Timeout and Scope).
|
||||
*/
|
||||
public interface LockRequest {
|
||||
static final int PESSIMISTIC_NO_WAIT = 0;
|
||||
static final int PESSIMISTIC_WAIT_FOREVER = -1;
|
||||
|
||||
|
||||
/**
|
||||
* Get the lock mode.
|
||||
*
|
||||
* @return the lock mode.
|
||||
*/
|
||||
LockMode getLockMode();
|
||||
|
@ -1017,6 +1023,7 @@ public interface Session extends Serializable {
|
|||
* Specify the LockMode to be used. The default is LockMode.none.
|
||||
*
|
||||
* @param lockMode
|
||||
*
|
||||
* @return this LockRequest instance for operation chaining.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
LockRequest setTimeOut(int timeout);
|
||||
|
||||
/**
|
||||
* Check if locking is cascaded to owned collections and relationships.
|
||||
*
|
||||
* @return true if locking will be extended to owned collections and relationships.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param scope
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
LockRequest setScope(boolean scope);
|
||||
|
@ -1055,7 +1065,5 @@ public interface Session extends Serializable {
|
|||
void lock(String entityName, 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.
|
||||
*/
|
||||
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
|
||||
*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.action;
|
||||
|
||||
|
@ -43,7 +42,7 @@ import org.hibernate.event.PreUpdateEvent;
|
|||
import org.hibernate.event.PreUpdateEventListener;
|
||||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
|
||||
public final class EntityUpdateAction extends EntityAction {
|
||||
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;
|
||||
// it is safe to copy in place, since by this time no-one else (should have)
|
||||
// has a reference to the array
|
||||
TypeFactory.deepCopy(
|
||||
TypeHelper.deepCopy(
|
||||
state,
|
||||
persister.getPropertyTypes(),
|
||||
persister.getPropertyCheckability(),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.cache;
|
||||
|
||||
|
@ -38,7 +37,7 @@ import org.hibernate.UnresolvableObjectException;
|
|||
import org.hibernate.cfg.Settings;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
|
||||
/**
|
||||
* The standard implementation of the Hibernate QueryCache interface. This
|
||||
|
@ -78,6 +77,7 @@ public class StandardQueryCache implements QueryCache {
|
|||
this.updateTimestampsCache = updateTimestampsCache;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnnecessaryBoxing", "unchecked" })
|
||||
public boolean put(
|
||||
QueryKey key,
|
||||
Type[] returnTypes,
|
||||
|
@ -88,7 +88,7 @@ public class StandardQueryCache implements QueryCache {
|
|||
return false;
|
||||
}
|
||||
else {
|
||||
Long ts = new Long( session.getTimestamp() );
|
||||
Long ts = Long.valueOf( session.getTimestamp() );
|
||||
|
||||
if ( log.isDebugEnabled() ) {
|
||||
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 );
|
||||
cacheable.add( ts );
|
||||
for ( int i = 0; i < result.size(); i++ ) {
|
||||
for ( Object aResult : result ) {
|
||||
if ( returnTypes.length == 1 ) {
|
||||
cacheable.add( returnTypes[0].disassemble( result.get( i ), session, null ) );
|
||||
cacheable.add( returnTypes[0].disassemble( aResult, session, null ) );
|
||||
}
|
||||
else {
|
||||
cacheable.add(
|
||||
TypeFactory.disassemble(
|
||||
( Object[] ) result.get( i ), returnTypes, null, session, null
|
||||
)
|
||||
TypeHelper.disassemble( (Object[]) aResult, returnTypes, null, session, null )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
cacheRegion.put( key, cacheable );
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public List get(
|
||||
QueryKey key,
|
||||
Type[] returnTypes,
|
||||
|
@ -145,7 +141,7 @@ public class StandardQueryCache implements QueryCache {
|
|||
returnTypes[0].beforeAssemble( ( Serializable ) cacheable.get( i ), session );
|
||||
}
|
||||
else {
|
||||
TypeFactory.beforeAssemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session );
|
||||
TypeHelper.beforeAssemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session );
|
||||
}
|
||||
}
|
||||
List result = new ArrayList( cacheable.size() - 1 );
|
||||
|
@ -156,9 +152,7 @@ public class StandardQueryCache implements QueryCache {
|
|||
}
|
||||
else {
|
||||
result.add(
|
||||
TypeFactory.assemble(
|
||||
( Serializable[] ) cacheable.get( i ), returnTypes, session, null
|
||||
)
|
||||
TypeHelper.assemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session, null )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.cache.entry;
|
||||
|
||||
|
@ -34,7 +33,7 @@ import org.hibernate.event.EventSource;
|
|||
import org.hibernate.event.PreLoadEvent;
|
||||
import org.hibernate.event.PreLoadEventListener;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +65,7 @@ public final class CacheEntry implements Serializable {
|
|||
final Object owner)
|
||||
throws HibernateException {
|
||||
//disassembled state gets put in a new array (we write to cache by value!)
|
||||
this.disassembledState = TypeFactory.disassemble(
|
||||
this.disassembledState = TypeHelper.disassemble(
|
||||
state,
|
||||
persister.getPropertyTypes(),
|
||||
persister.isLazyPropertiesCacheable() ?
|
||||
|
@ -112,11 +111,10 @@ public final class CacheEntry implements Serializable {
|
|||
final Serializable id,
|
||||
final EntityPersister persister,
|
||||
final Interceptor interceptor,
|
||||
final EventSource session)
|
||||
throws HibernateException {
|
||||
final EventSource session) throws HibernateException {
|
||||
|
||||
//assembled state gets put in a new array (we read from cache by value!)
|
||||
Object[] assembledProps = TypeFactory.assemble(
|
||||
Object[] assembledProps = TypeHelper.assemble(
|
||||
values,
|
||||
persister.getPropertyTypes(),
|
||||
session, result
|
||||
|
@ -132,8 +130,8 @@ public final class CacheEntry implements Serializable {
|
|||
.setPersister(persister);
|
||||
|
||||
PreLoadEventListener[] listeners = session.getListeners().getPreLoadEventListeners();
|
||||
for ( int i = 0; i < listeners.length; i++ ) {
|
||||
listeners[i].onPreLoad(preLoadEvent);
|
||||
for ( PreLoadEventListener listener : listeners ) {
|
||||
listener.onPreLoad( preLoadEvent );
|
||||
}
|
||||
|
||||
persister.setPropertyValues(
|
||||
|
|
|
@ -132,6 +132,7 @@ import org.hibernate.secure.JACCConfiguration;
|
|||
import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
|
||||
import org.hibernate.tool.hbm2ddl.TableMetadata;
|
||||
import org.hibernate.tool.hbm2ddl.IndexMetadata;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.BasicTypeRegistry;
|
||||
import org.hibernate.type.SerializationException;
|
||||
import org.hibernate.type.Type;
|
||||
|
@ -2286,6 +2287,10 @@ public class Configuration implements Serializable {
|
|||
return typeResolver;
|
||||
}
|
||||
|
||||
public void registerTypeOverride(BasicType type) {
|
||||
getTypeResolver().registerTypeOverride( type );
|
||||
}
|
||||
|
||||
public SessionFactoryObserver getSessionFactoryObserver() {
|
||||
return sessionFactoryObserver;
|
||||
}
|
||||
|
|
|
@ -1440,7 +1440,7 @@ public final class HbmBinder {
|
|||
|
||||
Element oneToManyNode = node.element( "one-to-many" );
|
||||
if ( oneToManyNode != null ) {
|
||||
OneToMany oneToMany = new OneToMany( collection.getOwner() );
|
||||
OneToMany oneToMany = new OneToMany( mappings, collection.getOwner() );
|
||||
collection.setElement( oneToMany );
|
||||
bindOneToMany( oneToManyNode, oneToMany, mappings );
|
||||
// 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" ) {
|
||||
public Collection create(Element node, String path, PersistentClass owner,
|
||||
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 );
|
||||
return map;
|
||||
}
|
||||
|
@ -2848,7 +2848,7 @@ public final class HbmBinder {
|
|||
private static final CollectionType SET = new CollectionType( "set" ) {
|
||||
public Collection create(Element node, String path, PersistentClass owner,
|
||||
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 );
|
||||
return set;
|
||||
}
|
||||
|
@ -2856,7 +2856,7 @@ public final class HbmBinder {
|
|||
private static final CollectionType LIST = new CollectionType( "list" ) {
|
||||
public Collection create(Element node, String path, PersistentClass owner,
|
||||
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 );
|
||||
return list;
|
||||
}
|
||||
|
@ -2864,7 +2864,7 @@ public final class HbmBinder {
|
|||
private static final CollectionType BAG = new CollectionType( "bag" ) {
|
||||
public Collection create(Element node, String path, PersistentClass owner,
|
||||
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 );
|
||||
return bag;
|
||||
}
|
||||
|
@ -2872,7 +2872,7 @@ public final class HbmBinder {
|
|||
private static final CollectionType IDBAG = new CollectionType( "idbag" ) {
|
||||
public Collection create(Element node, String path, PersistentClass owner,
|
||||
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 );
|
||||
return bag;
|
||||
}
|
||||
|
@ -2880,7 +2880,7 @@ public final class HbmBinder {
|
|||
private static final CollectionType ARRAY = new CollectionType( "array" ) {
|
||||
public Collection create(Element node, String path, PersistentClass owner,
|
||||
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 );
|
||||
return array;
|
||||
}
|
||||
|
@ -2888,7 +2888,7 @@ public final class HbmBinder {
|
|||
private static final CollectionType PRIMITIVE_ARRAY = new CollectionType( "primitive-array" ) {
|
||||
public Collection create(Element node, String path, PersistentClass owner,
|
||||
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 );
|
||||
return array;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
|
@ -44,7 +43,7 @@ import org.hibernate.persister.entity.EntityPersister;
|
|||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.property.BackrefPropertyAccessor;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
|
||||
/**
|
||||
* Functionality relating to Hibernate's two-phase loading process,
|
||||
|
@ -211,13 +210,13 @@ public final class TwoPhaseLoad {
|
|||
}
|
||||
else {
|
||||
//take a snapshot
|
||||
TypeFactory.deepCopy(
|
||||
TypeHelper.deepCopy(
|
||||
hydratedState,
|
||||
persister.getPropertyTypes(),
|
||||
persister.getPropertyUpdateability(),
|
||||
hydratedState, //after setting values to object, entityMode
|
||||
session
|
||||
);
|
||||
);
|
||||
persistenceContext.setEntryStatus(entityEntry, Status.MANAGED);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.event.def;
|
||||
|
||||
|
@ -38,7 +37,7 @@ import org.hibernate.event.AbstractEvent;
|
|||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
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
|
||||
|
@ -77,7 +76,7 @@ public class AbstractReassociateEventListener implements Serializable {
|
|||
|
||||
//get a snapshot
|
||||
Object[] values = persister.getPropertyValues( object, source.getEntityMode() );
|
||||
TypeFactory.deepCopy(
|
||||
TypeHelper.deepCopy(
|
||||
values,
|
||||
persister.getPropertyTypes(),
|
||||
persister.getPropertyUpdateability(),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.event.def;
|
||||
|
||||
|
@ -53,7 +52,7 @@ import org.hibernate.intercept.FieldInterceptor;
|
|||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
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.
|
||||
|
@ -300,7 +299,7 @@ public abstract class AbstractSaveEventListener extends AbstractReassociateEvent
|
|||
persister.setPropertyValues( entity, values, source.getEntityMode() );
|
||||
}
|
||||
|
||||
TypeFactory.deepCopy(
|
||||
TypeHelper.deepCopy(
|
||||
values,
|
||||
types,
|
||||
persister.getPropertyUpdateability(),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.event.def;
|
||||
|
||||
|
@ -34,7 +33,6 @@ import org.hibernate.CacheMode;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.TransientObjectException;
|
||||
import org.hibernate.util.IdentitySet;
|
||||
import org.hibernate.action.EntityDeleteAction;
|
||||
import org.hibernate.classic.Lifecycle;
|
||||
import org.hibernate.engine.Cascade;
|
||||
|
@ -51,7 +49,8 @@ import org.hibernate.event.EventSource;
|
|||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
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
|
||||
|
@ -299,7 +298,7 @@ public class DefaultDeleteEventListener implements DeleteEventListener {
|
|||
// TypeFactory.deepCopy( currentState, propTypes, persister.getPropertyUpdateability(), deletedState, session );
|
||||
boolean[] copyability = new boolean[propTypes.length];
|
||||
java.util.Arrays.fill( copyability, true );
|
||||
TypeFactory.deepCopy( currentState, propTypes, copyability, deletedState, session );
|
||||
TypeHelper.deepCopy( currentState, propTypes, copyability, deletedState, session );
|
||||
return deletedState;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ import org.hibernate.proxy.LazyInitializer;
|
|||
import org.hibernate.type.EmbeddedComponentType;
|
||||
import org.hibernate.type.EntityType;
|
||||
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
|
||||
|
@ -648,13 +648,13 @@ public class DefaultLoadEventListener extends AbstractLockUpgradeEventListener i
|
|||
|
||||
Type[] types = subclassPersister.getPropertyTypes();
|
||||
Object[] values = entry.assemble( result, id, subclassPersister, session.getInterceptor(), session ); // intializes result by side-effect
|
||||
TypeFactory.deepCopy(
|
||||
TypeHelper.deepCopy(
|
||||
values,
|
||||
types,
|
||||
subclassPersister.getPropertyUpdateability(),
|
||||
values,
|
||||
session
|
||||
);
|
||||
);
|
||||
|
||||
Object version = Versioning.getVersion( values, subclassPersister );
|
||||
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.LazyInitializer;
|
||||
import org.hibernate.type.ForeignKeyDirection;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
|
||||
/**
|
||||
* 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 Map copyCache
|
||||
) {
|
||||
final Object[] copiedValues = TypeFactory.replace(
|
||||
final Object[] copiedValues = TypeHelper.replace(
|
||||
persister.getPropertyValues( entity, source.getEntityMode() ),
|
||||
persister.getPropertyValues( target, source.getEntityMode() ),
|
||||
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
|
||||
// replacement to associations types (value types were already replaced
|
||||
// during the first pass)
|
||||
copiedValues = TypeFactory.replaceAssociations(
|
||||
copiedValues = TypeHelper.replaceAssociations(
|
||||
persister.getPropertyValues( entity, source.getEntityMode() ),
|
||||
persister.getPropertyValues( target, source.getEntityMode() ),
|
||||
persister.getPropertyTypes(),
|
||||
|
@ -529,7 +529,7 @@ public class DefaultMergeEventListener extends AbstractSaveEventListener
|
|||
);
|
||||
}
|
||||
else {
|
||||
copiedValues = TypeFactory.replace(
|
||||
copiedValues = TypeHelper.replace(
|
||||
persister.getPropertyValues( entity, source.getEntityMode() ),
|
||||
persister.getPropertyValues( target, source.getEntityMode() ),
|
||||
persister.getPropertyTypes(),
|
||||
|
|
|
@ -117,7 +117,10 @@ class FromElementType {
|
|||
public Type getSelectType() {
|
||||
if (entityType==null) return null;
|
||||
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 );
|
||||
Queryable classPersister = q.getEntityPersister( entityName );
|
||||
//QueryJoinFragment join = q.createJoinFragment(useThetaStyleJoin);
|
||||
addJoin( currentName, TypeFactory.manyToOne( entityName ), joinColumns );
|
||||
addJoin( currentName, q.getFactory().getTypeResolver().getTypeFactory().manyToOne( entityName ), joinColumns );
|
||||
currentPropertyMapping = classPersister;
|
||||
return currentName;
|
||||
}
|
||||
|
|
|
@ -662,7 +662,9 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
int j = 0;
|
||||
for ( int i = 0; i < persisters.length; 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();
|
||||
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();
|
||||
for ( int i = 0; i < idColumnNames.length; i++ ) {
|
||||
|
|
|
@ -62,6 +62,7 @@ import org.hibernate.StatelessSession;
|
|||
import org.hibernate.SessionFactoryObserver;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.Cache;
|
||||
import org.hibernate.TypeHelper;
|
||||
import org.hibernate.tuple.entity.EntityTuplizer;
|
||||
import org.hibernate.cache.CacheKey;
|
||||
import org.hibernate.cache.CollectionRegion;
|
||||
|
@ -114,7 +115,6 @@ import org.hibernate.pretty.MessageHelper;
|
|||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||
import org.hibernate.stat.Statistics;
|
||||
import org.hibernate.stat.StatisticsImpl;
|
||||
import org.hibernate.stat.ConcurrentStatisticsImpl;
|
||||
import org.hibernate.stat.StatisticsImplementor;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
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 transient boolean isClosed = false;
|
||||
private final transient TypeResolver typeResolver;
|
||||
private final transient TypeHelper typeHelper;
|
||||
|
||||
public SessionFactoryImpl(
|
||||
Configuration cfg,
|
||||
|
@ -234,6 +235,7 @@ public final class SessionFactoryImpl implements SessionFactory, SessionFactoryI
|
|||
};
|
||||
|
||||
this.typeResolver = cfg.getTypeResolver().scope( this );
|
||||
this.typeHelper = new TypeLocatorImpl( typeResolver );
|
||||
|
||||
this.filters = new HashMap();
|
||||
this.filters.putAll( cfg.getFilterDefinitions() );
|
||||
|
@ -1302,6 +1304,10 @@ public final class SessionFactoryImpl implements SessionFactory, SessionFactoryI
|
|||
return ( FetchProfile ) fetchProfiles.get( name );
|
||||
}
|
||||
|
||||
public TypeHelper getTypeHelper() {
|
||||
return typeHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom serialization hook used during Session serialization.
|
||||
*
|
||||
|
|
|
@ -66,6 +66,7 @@ import org.hibernate.SessionException;
|
|||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.TransientObjectException;
|
||||
import org.hibernate.TypeHelper;
|
||||
import org.hibernate.UnresolvableObjectException;
|
||||
import org.hibernate.UnknownProfileException;
|
||||
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 {
|
||||
public String resolveEntityName(Object 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 {
|
||||
resultTypes = new Type[] { TypeFactory.manyToOne( persister.getEntityName() ) };
|
||||
resultTypes = new Type[] { factory.getTypeResolver().getTypeFactory().manyToOne( persister.getEntityName() ) };
|
||||
|
||||
initAll( translator.getWhereCondition(), translator.getOrderBy(), LockOptions.NONE );
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -55,7 +55,8 @@ public class Any extends SimpleValue {
|
|||
|
||||
public Type getType() throws MappingException {
|
||||
final Type metaType = getMappings().getTypeResolver().heuristicType( metaTypeName );
|
||||
return new AnyType(
|
||||
|
||||
return getMappings().getTypeResolver().getTypeFactory().any(
|
||||
metaValues == null ? metaType : new MetaType( metaValues, metaType ),
|
||||
getMappings().getTypeResolver().heuristicType( identifierTypeName )
|
||||
);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,31 +20,27 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.PrimitiveType;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
|
||||
/**
|
||||
* An array mapping has a primary key consisting of
|
||||
* the key columns + index column.
|
||||
* An array mapping has a primary key consisting of the key columns + index column.
|
||||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class Array extends List {
|
||||
|
||||
private String elementClassName;
|
||||
|
||||
/**
|
||||
* Constructor for Array.
|
||||
* @param owner
|
||||
*/
|
||||
public Array(PersistentClass owner) {
|
||||
super(owner);
|
||||
public Array(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public Class getElementClass() throws MappingException {
|
||||
|
@ -65,7 +61,9 @@ public class Array extends List {
|
|||
}
|
||||
|
||||
public CollectionType getDefaultCollectionType() throws MappingException {
|
||||
return TypeFactory.array( getRole(), getReferencedPropertyName(), isEmbedded(), getElementClass() );
|
||||
return getMappings().getTypeResolver()
|
||||
.getTypeFactory()
|
||||
.array( getRole(), getReferencedPropertyName(), isEmbedded(), getElementClass() );
|
||||
}
|
||||
|
||||
public boolean isArray() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,12 +20,11 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
|
||||
/**
|
||||
* 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 Bag(PersistentClass owner) {
|
||||
super(owner);
|
||||
public Bag(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public CollectionType getDefaultCollectionType() {
|
||||
return TypeFactory.bag( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
return getMappings().getTypeResolver()
|
||||
.getTypeFactory()
|
||||
.bag( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
}
|
||||
|
||||
void createPrimaryKey() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
@ -32,6 +31,7 @@ import java.util.Properties;
|
|||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.engine.Mapping;
|
||||
import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
|
||||
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_KEY_COLUMN_NAME = "id";
|
||||
|
||||
private final Mappings mappings;
|
||||
private PersistentClass owner;
|
||||
|
||||
private KeyValue key;
|
||||
private Value element;
|
||||
private Table collectionTable;
|
||||
|
@ -66,7 +69,6 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
private String where;
|
||||
private String manyToManyWhere;
|
||||
private String manyToManyOrderBy;
|
||||
private PersistentClass owner;
|
||||
private String referencedPropertyName;
|
||||
private String nodeName;
|
||||
private String elementNodeName;
|
||||
|
@ -100,10 +102,15 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
|
||||
private String loaderName;
|
||||
|
||||
protected Collection(PersistentClass owner) {
|
||||
protected Collection(Mappings mappings, PersistentClass owner) {
|
||||
this.mappings = mappings;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public Mappings getMappings() {
|
||||
return mappings;
|
||||
}
|
||||
|
||||
public boolean isSet() {
|
||||
return false;
|
||||
}
|
||||
|
@ -221,6 +228,11 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
return owner;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Inject the owner into constructor.
|
||||
*
|
||||
* @param owner The owner
|
||||
*/
|
||||
public void setOwner(PersistentClass owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -183,10 +183,10 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
// TODO : temporary initial step towards HHH-1907
|
||||
ComponentMetamodel metamodel = new ComponentMetamodel( this );
|
||||
if ( isEmbedded() ) {
|
||||
return new EmbeddedComponentType( metamodel );
|
||||
return getMappings().getTypeResolver().getTypeFactory().embeddedComponent( metamodel );
|
||||
}
|
||||
else {
|
||||
return new ComponentType( metamodel );
|
||||
return getMappings().getTypeResolver().getTypeFactory().component( metamodel );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,10 +20,10 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
|
||||
|
@ -33,12 +33,14 @@ import org.hibernate.type.TypeFactory;
|
|||
*/
|
||||
public class IdentifierBag extends IdentifierCollection {
|
||||
|
||||
public IdentifierBag(PersistentClass owner) {
|
||||
super(owner);
|
||||
public IdentifierBag(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public CollectionType getDefaultCollectionType() {
|
||||
return TypeFactory.idbag( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
return getMappings().getTypeResolver()
|
||||
.getTypeFactory()
|
||||
.idbag( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
}
|
||||
|
||||
public Object accept(ValueVisitor visitor) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,11 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.engine.Mapping;
|
||||
|
||||
/**
|
||||
|
@ -36,8 +36,8 @@ public abstract class IdentifierCollection extends Collection {
|
|||
|
||||
private KeyValue identifier;
|
||||
|
||||
public IdentifierCollection(PersistentClass owner) {
|
||||
super(owner);
|
||||
public IdentifierCollection(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public KeyValue getIdentifier() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,13 +20,13 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.engine.Mapping;
|
||||
|
||||
/**
|
||||
|
@ -41,8 +41,8 @@ public abstract class IndexedCollection extends Collection {
|
|||
private Value index;
|
||||
private String indexNodeName;
|
||||
|
||||
public IndexedCollection(PersistentClass owner) {
|
||||
super(owner);
|
||||
public IndexedCollection(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public Value getIndex() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,17 +20,17 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
|
||||
/**
|
||||
* A list mapping has a primary key consisting of
|
||||
* the key columns + index column.
|
||||
* A list mapping has a primary key consisting of the key columns + index column.
|
||||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class List extends IndexedCollection {
|
||||
|
@ -41,12 +41,14 @@ public class List extends IndexedCollection {
|
|||
return true;
|
||||
}
|
||||
|
||||
public List(PersistentClass owner) {
|
||||
super(owner);
|
||||
public List(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public CollectionType getDefaultCollectionType() throws MappingException {
|
||||
return TypeFactory.list( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
return getMappings().getTypeResolver()
|
||||
.getTypeFactory()
|
||||
.list( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
}
|
||||
|
||||
public Object accept(ValueVisitor visitor) {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
@ -47,7 +46,7 @@ public class ManyToOne extends ToOne {
|
|||
}
|
||||
|
||||
public Type getType() throws MappingException {
|
||||
return TypeFactory.manyToOne(
|
||||
return getMappings().getTypeResolver().getTypeFactory().manyToOne(
|
||||
getReferencedEntityName(),
|
||||
getReferencedPropertyName(),
|
||||
isLazy(),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,11 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
|
||||
|
@ -34,8 +34,8 @@ import org.hibernate.type.TypeFactory;
|
|||
*/
|
||||
public class Map extends IndexedCollection {
|
||||
|
||||
public Map(PersistentClass owner) {
|
||||
super(owner);
|
||||
public Map(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public boolean isMap() {
|
||||
|
@ -44,13 +44,19 @@ public class Map extends IndexedCollection {
|
|||
|
||||
public CollectionType getDefaultCollectionType() {
|
||||
if ( isSorted() ) {
|
||||
return TypeFactory.sortedMap( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
|
||||
return getMappings().getTypeResolver()
|
||||
.getTypeFactory()
|
||||
.sortedMap( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
|
||||
}
|
||||
else if ( hasOrder() ) {
|
||||
return TypeFactory.orderedMap( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
return getMappings().getTypeResolver()
|
||||
.getTypeFactory()
|
||||
.orderedMap( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
}
|
||||
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;
|
||||
|
||||
import java.util.*;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
@ -28,6 +27,7 @@ import java.util.Iterator;
|
|||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.engine.Mapping;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
|
@ -39,24 +39,28 @@ import org.hibernate.type.TypeFactory;
|
|||
*/
|
||||
public class OneToMany implements Value {
|
||||
|
||||
private final Mappings mappings;
|
||||
private final Table referencingTable;
|
||||
|
||||
private String referencedEntityName;
|
||||
private Table referencingTable;
|
||||
private PersistentClass associatedClass;
|
||||
private boolean embedded;
|
||||
private boolean ignoreNotFound;
|
||||
|
||||
private EntityType getEntityType() {
|
||||
return TypeFactory.manyToOne(
|
||||
return mappings.getTypeResolver().getTypeFactory().manyToOne(
|
||||
getReferencedEntityName(),
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
@ -71,7 +70,7 @@ public class OneToOne extends ToOne {
|
|||
|
||||
public Type getType() throws MappingException {
|
||||
if ( getColumnIterator().hasNext() ) {
|
||||
return new SpecialOneToOneType(
|
||||
return getMappings().getTypeResolver().getTypeFactory().specialOneToOne(
|
||||
getReferencedEntityName(),
|
||||
foreignKeyType,
|
||||
referencedPropertyName,
|
||||
|
@ -79,10 +78,10 @@ public class OneToOne extends ToOne {
|
|||
isUnwrapProxy(),
|
||||
entityName,
|
||||
propertyName
|
||||
);
|
||||
);
|
||||
}
|
||||
else {
|
||||
return TypeFactory.oneToOne(
|
||||
return getMappings().getTypeResolver().getTypeFactory().oneToOne(
|
||||
getReferencedEntityName(),
|
||||
foreignKeyType,
|
||||
referencedPropertyName,
|
||||
|
@ -91,7 +90,7 @@ public class OneToOne extends ToOne {
|
|||
isEmbedded(),
|
||||
entityName,
|
||||
propertyName
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,18 +20,18 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.cfg.Mappings;
|
||||
|
||||
/**
|
||||
* A primitive array has a primary key consisting
|
||||
* of the key columns + index column.
|
||||
* A primitive array has a primary key consisting of the key columns + index column.
|
||||
*/
|
||||
public class PrimitiveArray extends Array {
|
||||
|
||||
public PrimitiveArray(PersistentClass owner) {
|
||||
super(owner);
|
||||
public PrimitiveArray(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public boolean isPrimitiveArray() {
|
||||
|
@ -42,10 +42,3 @@ public class PrimitiveArray extends Array {
|
|||
return visitor.accept(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,13 +20,13 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
import org.hibernate.engine.Mapping;
|
||||
import org.hibernate.type.CollectionType;
|
||||
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() );*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for Set.
|
||||
* @param owner
|
||||
*/
|
||||
public Set(PersistentClass owner) {
|
||||
super(owner);
|
||||
public Set(Mappings mappings, PersistentClass owner) {
|
||||
super( mappings, owner );
|
||||
}
|
||||
|
||||
public boolean isSet() {
|
||||
|
@ -65,13 +61,19 @@ public class Set extends Collection {
|
|||
|
||||
public CollectionType getDefaultCollectionType() {
|
||||
if ( isSorted() ) {
|
||||
return TypeFactory.sortedSet( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
|
||||
return getMappings().getTypeResolver()
|
||||
.getTypeFactory()
|
||||
.sortedSet( getRole(), getReferencedPropertyName(), isEmbedded(), getComparator() );
|
||||
}
|
||||
else if ( hasOrder() ) {
|
||||
return TypeFactory.orderedSet( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
return getMappings().getTypeResolver()
|
||||
.getTypeFactory()
|
||||
.orderedSet( getRole(), getReferencedPropertyName(), isEmbedded() );
|
||||
}
|
||||
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
|
||||
*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* 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
|
||||
* 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,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<!--
|
||||
~ 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
|
||||
~ 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,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,7 +20,6 @@
|
|||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
~
|
||||
-->
|
||||
|
||||
<html>
|
||||
|
|
|
@ -107,7 +107,7 @@ import org.hibernate.type.AbstractComponentType;
|
|||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeFactory;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
import org.hibernate.type.VersionType;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
import org.hibernate.util.FilterHelper;
|
||||
|
@ -3377,7 +3377,7 @@ public abstract class AbstractEntityPersister
|
|||
*/
|
||||
public int[] findDirty(Object[] currentState, Object[] previousState, Object entity, SessionImplementor session)
|
||||
throws HibernateException {
|
||||
int[] props = TypeFactory.findDirty(
|
||||
int[] props = TypeHelper.findDirty(
|
||||
entityMetamodel.getProperties(),
|
||||
currentState,
|
||||
previousState,
|
||||
|
@ -3406,7 +3406,7 @@ public abstract class AbstractEntityPersister
|
|||
*/
|
||||
public int[] findModified(Object[] old, Object[] current, Object entity, SessionImplementor session)
|
||||
throws HibernateException {
|
||||
int[] props = TypeFactory.findModified(
|
||||
int[] props = TypeHelper.findModified(
|
||||
entityMetamodel.getProperties(),
|
||||
current,
|
||||
old,
|
||||
|
|
|
@ -131,7 +131,7 @@ public class EntityMetamodel implements Serializable {
|
|||
|
||||
name = persistentClass.getEntityName();
|
||||
rootName = persistentClass.getRootClass().getEntityName();
|
||||
entityType = TypeFactory.manyToOne( name );
|
||||
entityType = sessionFactory.getTypeResolver().getTypeFactory().manyToOne( name );
|
||||
|
||||
identifierProperty = PropertyFactory.buildIdentifierProperty(
|
||||
persistentClass,
|
||||
|
|
|
@ -48,8 +48,8 @@ public class ArrayType extends CollectionType {
|
|||
private final Class elementClass;
|
||||
private final Class arrayClass;
|
||||
|
||||
public ArrayType(String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) {
|
||||
super(role, propertyRef, isEmbeddedInXML);
|
||||
public ArrayType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
this.elementClass = elementClass;
|
||||
arrayClass = Array.newInstance(elementClass, 0).getClass();
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
|||
|
||||
public class BagType extends CollectionType {
|
||||
|
||||
public BagType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super(role, propertyRef, isEmbeddedInXML);
|
||||
public BagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
}
|
||||
|
||||
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" );
|
||||
public static final Object UNFETCHED_COLLECTION = new MarkerObject( "UNFETCHED COLLECTION" );
|
||||
|
||||
private final TypeFactory.TypeScope typeScope;
|
||||
private final String role;
|
||||
private final String foreignKeyPropertyName;
|
||||
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.foreignKeyPropertyName = foreignKeyPropertyName;
|
||||
this.isEmbeddedInXML = isEmbeddedInXML;
|
||||
|
|
|
@ -56,6 +56,7 @@ import org.hibernate.util.StringHelper;
|
|||
*/
|
||||
public class ComponentType extends AbstractType implements AbstractComponentType {
|
||||
|
||||
private final TypeFactory.TypeScope typeScope;
|
||||
private final String[] propertyNames;
|
||||
private final Type[] propertyTypes;
|
||||
private final boolean[] propertyNullability;
|
||||
|
@ -66,7 +67,8 @@ public class ComponentType extends AbstractType implements AbstractComponentType
|
|||
|
||||
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)
|
||||
this.isKey = metamodel.isKey();
|
||||
this.propertySpan = metamodel.getPropertySpan();
|
||||
|
@ -456,7 +458,7 @@ public class ComponentType extends AbstractType implements AbstractComponentType
|
|||
: target;
|
||||
|
||||
final EntityMode entityMode = session.getEntityMode();
|
||||
Object[] values = TypeFactory.replace(
|
||||
Object[] values = TypeHelper.replace(
|
||||
getPropertyValues( original, entityMode ),
|
||||
getPropertyValues( result, entityMode ),
|
||||
propertyTypes,
|
||||
|
@ -488,7 +490,7 @@ public class ComponentType extends AbstractType implements AbstractComponentType
|
|||
target;
|
||||
|
||||
final EntityMode entityMode = session.getEntityMode();
|
||||
Object[] values = TypeFactory.replace(
|
||||
Object[] values = TypeHelper.replace(
|
||||
getPropertyValues( original, entityMode ),
|
||||
getPropertyValues( result, entityMode ),
|
||||
propertyTypes,
|
||||
|
|
|
@ -48,8 +48,13 @@ public class CustomCollectionType extends CollectionType {
|
|||
private final UserCollectionType userType;
|
||||
private final boolean customLogging;
|
||||
|
||||
public CustomCollectionType(Class userTypeClass, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML) {
|
||||
super(role, foreignKeyPropertyName, isEmbeddedInXML);
|
||||
public CustomCollectionType(
|
||||
TypeFactory.TypeScope typeScope,
|
||||
Class userTypeClass,
|
||||
String role,
|
||||
String foreignKeyPropertyName,
|
||||
boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, foreignKeyPropertyName, isEmbeddedInXML );
|
||||
|
||||
if ( !UserCollectionType.class.isAssignableFrom( userTypeClass ) ) {
|
||||
throw new MappingException( "Custom type does not implement UserCollectionType: " + userTypeClass.getName() );
|
||||
|
|
|
@ -40,8 +40,8 @@ public class EmbeddedComponentType extends ComponentType {
|
|||
return true;
|
||||
}
|
||||
|
||||
public EmbeddedComponentType(ComponentMetamodel metamodel) {
|
||||
super( metamodel );
|
||||
public EmbeddedComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
|
||||
super( typeScope, metamodel );
|
||||
}
|
||||
|
||||
public boolean isMethodOf(Method method) {
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.hibernate.util.ReflectHelper;
|
|||
*/
|
||||
public abstract class EntityType extends AbstractType implements AssociationType {
|
||||
|
||||
private final TypeFactory.TypeScope scope;
|
||||
private final String associatedEntityName;
|
||||
protected final String uniqueKeyPropertyName;
|
||||
protected final boolean isEmbeddedInXML;
|
||||
|
@ -66,6 +67,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
|||
/**
|
||||
* Constructs the requested entity type mapping.
|
||||
*
|
||||
* @param scope The type scope
|
||||
* @param entityName The name of the associated entity.
|
||||
* @param uniqueKeyPropertyName The property-ref name, or null if we
|
||||
* reference the PK of the associated entity.
|
||||
|
@ -76,11 +78,13 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
|||
* with lazy="no-proxy".
|
||||
*/
|
||||
protected EntityType(
|
||||
TypeFactory.TypeScope scope,
|
||||
String entityName,
|
||||
String uniqueKeyPropertyName,
|
||||
boolean eager,
|
||||
boolean isEmbeddedInXML,
|
||||
boolean unwrapProxy) {
|
||||
this.scope = scope;
|
||||
this.associatedEntityName = entityName;
|
||||
this.uniqueKeyPropertyName = uniqueKeyPropertyName;
|
||||
this.isEmbeddedInXML = isEmbeddedInXML;
|
||||
|
@ -88,6 +92,10 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
|||
this.unwrapProxy = unwrapProxy;
|
||||
}
|
||||
|
||||
protected TypeFactory.TypeScope scope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 IdentifierBagType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super(role, propertyRef, isEmbeddedInXML);
|
||||
public IdentifierBagType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
}
|
||||
|
||||
public PersistentCollection instantiate(
|
||||
|
|
|
@ -37,8 +37,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
|||
|
||||
public class ListType extends CollectionType {
|
||||
|
||||
public ListType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super(role, propertyRef, isEmbeddedInXML);
|
||||
public ListType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* @param scope The scope for this instance.
|
||||
* @param referencedEntityName The name iof the referenced entity
|
||||
*/
|
||||
public ManyToOneType(String referencedEntityName) {
|
||||
this( referencedEntityName, false );
|
||||
public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName) {
|
||||
this( scope, referencedEntityName, false );
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a many-to-one association type with the given referenced entity and the
|
||||
* given laziness characteristic
|
||||
*
|
||||
* @param scope The scope for this instance.
|
||||
* @param referencedEntityName The name iof the referenced entity
|
||||
* @param lazy Should the association be handled lazily
|
||||
*/
|
||||
public ManyToOneType(String referencedEntityName, boolean lazy) {
|
||||
this( referencedEntityName, null, lazy, true, 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(TypeFactory.TypeScope scope, String referencedEntityName, boolean lazy) {
|
||||
this( scope, referencedEntityName, null, lazy, true, false, false, false );
|
||||
}
|
||||
|
||||
public ManyToOneType(
|
||||
TypeFactory.TypeScope scope,
|
||||
String referencedEntityName,
|
||||
String uniqueKeyPropertyName,
|
||||
boolean lazy,
|
||||
|
@ -89,7 +78,7 @@ public class ManyToOneType extends EntityType {
|
|||
boolean isEmbeddedInXML,
|
||||
boolean ignoreNotFound,
|
||||
boolean isLogicalOneToOne) {
|
||||
super( referencedEntityName, uniqueKeyPropertyName, !lazy, isEmbeddedInXML, unwrapProxy );
|
||||
super( scope, referencedEntityName, uniqueKeyPropertyName, !lazy, isEmbeddedInXML, unwrapProxy );
|
||||
this.ignoreNotFound = ignoreNotFound;
|
||||
this.isLogicalOneToOne = isLogicalOneToOne;
|
||||
}
|
||||
|
@ -162,17 +151,14 @@ public class ManyToOneType extends EntityType {
|
|||
/**
|
||||
* Register the entity as batch loadable, if enabled
|
||||
*/
|
||||
private void scheduleBatchLoadIfNeeded(
|
||||
Serializable id,
|
||||
SessionImplementor session) throws MappingException {
|
||||
@SuppressWarnings({ "JavaDoc" })
|
||||
private void scheduleBatchLoadIfNeeded(Serializable id, SessionImplementor session) throws MappingException {
|
||||
//cannot batch fetch by unique key (property-ref associations)
|
||||
if ( uniqueKeyPropertyName == null && id != null ) {
|
||||
EntityPersister persister = session.getFactory().getEntityPersister( getAssociatedEntityName() );
|
||||
EntityKey entityKey = new EntityKey( id, persister, session.getEntityMode() );
|
||||
if ( !session.getPersistenceContext().containsEntity( entityKey ) ) {
|
||||
session.getPersistenceContext()
|
||||
.getBatchFetchQueue()
|
||||
.addBatchLoadableEntityKey( entityKey );
|
||||
session.getPersistenceContext().getBatchFetchQueue().addBatchLoadableEntityKey( entityKey );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
|||
|
||||
public class MapType extends CollectionType {
|
||||
|
||||
public MapType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super(role, propertyRef, isEmbeddedInXML);
|
||||
public MapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
}
|
||||
|
||||
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
|
||||
|
|
|
@ -45,6 +45,22 @@ public class OneToOneType extends EntityType {
|
|||
private final ForeignKeyDirection foreignKeyType;
|
||||
private final String propertyName;
|
||||
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() {
|
||||
return propertyName;
|
||||
|
@ -82,28 +98,6 @@ public class OneToOneType extends EntityType {
|
|||
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) {
|
||||
//nothing to do
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ public class OrderedMapType extends MapType {
|
|||
* @param propertyRef The property ref name.
|
||||
* @param isEmbeddedInXML Is this collection to embed itself in xml
|
||||
*/
|
||||
public OrderedMapType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super( role, propertyRef, isEmbeddedInXML );
|
||||
public OrderedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean 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
|
||||
* role.
|
||||
*
|
||||
* @param typeScope The scope for this type instance.
|
||||
* @param role The collection role name.
|
||||
* @param propertyRef The property ref name.
|
||||
* @param isEmbeddedInXML Is this collection to embed itself in xml
|
||||
*/
|
||||
public OrderedSetType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super( role, propertyRef, isEmbeddedInXML );
|
||||
public OrderedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -36,8 +36,8 @@ import org.hibernate.persister.collection.CollectionPersister;
|
|||
|
||||
public class SetType extends CollectionType {
|
||||
|
||||
public SetType(String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super(role, propertyRef, isEmbeddedInXML);
|
||||
public SetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
}
|
||||
|
||||
public PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key) {
|
||||
|
|
|
@ -41,8 +41,8 @@ public class SortedMapType extends MapType {
|
|||
|
||||
private final Comparator comparator;
|
||||
|
||||
public SortedMapType(String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
|
||||
super(role, propertyRef, isEmbeddedInXML);
|
||||
public SortedMapType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ public class SortedSetType extends SetType {
|
|||
|
||||
private final Comparator comparator;
|
||||
|
||||
public SortedSetType(String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
|
||||
super(role, propertyRef, isEmbeddedInXML);
|
||||
public SortedSetType(TypeFactory.TypeScope typeScope, String role, String propertyRef, Comparator comparator, boolean isEmbeddedInXML) {
|
||||
super( typeScope, role, propertyRef, isEmbeddedInXML );
|
||||
this.comparator = comparator;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,15 +43,16 @@ import org.hibernate.engine.SessionImplementor;
|
|||
public class SpecialOneToOneType extends OneToOneType {
|
||||
|
||||
public SpecialOneToOneType(
|
||||
TypeFactory.TypeScope scope,
|
||||
String referencedEntityName,
|
||||
ForeignKeyDirection foreignKeyType,
|
||||
String uniqueKeyPropertyName,
|
||||
boolean lazy,
|
||||
boolean unwrapProxy,
|
||||
String entityName,
|
||||
String propertyName
|
||||
) {
|
||||
String propertyName) {
|
||||
super(
|
||||
scope,
|
||||
referencedEntityName,
|
||||
foreignKeyType,
|
||||
uniqueKeyPropertyName,
|
||||
|
|
|
@ -25,7 +25,6 @@ package org.hibernate.type;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
@ -34,15 +33,18 @@ import org.slf4j.LoggerFactory;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.classic.Lifecycle;
|
||||
import org.hibernate.classic.Validatable;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.tuple.StandardProperty;
|
||||
import org.hibernate.tuple.component.ComponentMetamodel;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
import org.hibernate.usertype.ParameterizedType;
|
||||
import org.hibernate.usertype.UserType;
|
||||
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
|
||||
* and constants on <tt>org.hibernate.Hibernate</tt>.
|
||||
*
|
||||
|
@ -97,9 +99,9 @@ public final class TypeFactory implements Serializable {
|
|||
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*
|
||||
return new ManyToOneType( clazz.getName() );
|
||||
return manyToOne( clazz.getName() );
|
||||
}
|
||||
|
||||
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 ) ) {
|
||||
( (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 {
|
||||
CompositeUserType userType = typeClass.newInstance();
|
||||
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 {
|
||||
UserType userType = typeClass.newInstance();
|
||||
injectParameters( userType, parameters );
|
||||
|
@ -164,10 +186,9 @@ public final class TypeFactory implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* A one-to-one association type for the given class
|
||||
*/
|
||||
public static EntityType oneToOne(
|
||||
// one-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
public EntityType oneToOne(
|
||||
String persistentClass,
|
||||
ForeignKeyDirection foreignKeyType,
|
||||
String uniqueKeyPropertyName,
|
||||
|
@ -175,61 +196,35 @@ public final class TypeFactory implements Serializable {
|
|||
boolean unwrapProxy,
|
||||
boolean isEmbeddedInXML,
|
||||
String entityName,
|
||||
String propertyName
|
||||
) {
|
||||
return new OneToOneType(
|
||||
persistentClass,
|
||||
foreignKeyType,
|
||||
uniqueKeyPropertyName,
|
||||
lazy,
|
||||
unwrapProxy,
|
||||
isEmbeddedInXML,
|
||||
entityName,
|
||||
propertyName
|
||||
);
|
||||
String propertyName) {
|
||||
return new OneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName,
|
||||
lazy, unwrapProxy, isEmbeddedInXML, entityName, propertyName );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(
|
||||
public EntityType specialOneToOne(
|
||||
String persistentClass,
|
||||
ForeignKeyDirection foreignKeyType,
|
||||
String uniqueKeyPropertyName,
|
||||
boolean lazy,
|
||||
boolean unwrapProxy,
|
||||
boolean isEmbeddedInXML,
|
||||
boolean ignoreNotFound) {
|
||||
//noinspection deprecation
|
||||
return new ManyToOneType(
|
||||
persistentClass,
|
||||
uniqueKeyPropertyName,
|
||||
lazy,
|
||||
unwrapProxy,
|
||||
isEmbeddedInXML,
|
||||
ignoreNotFound
|
||||
);
|
||||
String entityName,
|
||||
String propertyName) {
|
||||
return new SpecialOneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName,
|
||||
lazy, unwrapProxy, entityName, propertyName );
|
||||
}
|
||||
|
||||
/**
|
||||
* A many-to-one association type for the given class
|
||||
*/
|
||||
public static EntityType manyToOne(
|
||||
|
||||
// many-to-one type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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 uniqueKeyPropertyName,
|
||||
boolean lazy,
|
||||
|
@ -238,6 +233,7 @@ public final class TypeFactory implements Serializable {
|
|||
boolean ignoreNotFound,
|
||||
boolean isLogicalOneToOne) {
|
||||
return new ManyToOneType(
|
||||
typeScope,
|
||||
persistentClass,
|
||||
uniqueKeyPropertyName,
|
||||
lazy,
|
||||
|
@ -248,299 +244,64 @@ public final class TypeFactory implements Serializable {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The legacy contract.
|
||||
*
|
||||
* @deprecated Use {@link #customCollection(String, java.util.Properties, String, String, boolean)} instead
|
||||
*/
|
||||
public static CollectionType customCollection(
|
||||
String typeName,
|
||||
String role,
|
||||
String propertyRef,
|
||||
boolean embedded) {
|
||||
return customCollection( typeName, null, role, propertyRef, embedded );
|
||||
|
||||
// collection type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
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,
|
||||
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;
|
||||
public CollectionType list(String role, String propertyRef, boolean embedded) {
|
||||
return new ListType( typeScope, role, propertyRef, embedded );
|
||||
}
|
||||
|
||||
// Collection Types:
|
||||
|
||||
public static CollectionType array(String role, String propertyRef, boolean embedded,
|
||||
Class elementClass) {
|
||||
return new ArrayType( role, propertyRef, elementClass, embedded );
|
||||
public CollectionType bag(String role, String propertyRef, boolean embedded) {
|
||||
return new BagType( typeScope, role, propertyRef, embedded );
|
||||
}
|
||||
|
||||
public static CollectionType list(String role, String propertyRef, boolean embedded) {
|
||||
return new ListType( role, propertyRef, embedded );
|
||||
public CollectionType idbag(String role, String propertyRef, boolean embedded) {
|
||||
return new IdentifierBagType( typeScope, role, propertyRef, embedded );
|
||||
}
|
||||
|
||||
public static CollectionType bag(String role, String propertyRef, boolean embedded) {
|
||||
return new BagType( role, propertyRef, embedded );
|
||||
public CollectionType map(String role, String propertyRef, boolean embedded) {
|
||||
return new MapType( typeScope, role, propertyRef, embedded );
|
||||
}
|
||||
|
||||
public static CollectionType idbag(String role, String propertyRef, boolean embedded) {
|
||||
return new IdentifierBagType( role, propertyRef, embedded );
|
||||
public CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
|
||||
return new OrderedMapType( typeScope, role, propertyRef, embedded );
|
||||
}
|
||||
|
||||
public static CollectionType map(String role, String propertyRef, boolean embedded) {
|
||||
return new MapType( role, propertyRef, embedded );
|
||||
public CollectionType sortedMap(String role, String propertyRef, boolean embedded, Comparator comparator) {
|
||||
return new SortedMapType( typeScope, role, propertyRef, comparator, embedded );
|
||||
}
|
||||
|
||||
public static CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
|
||||
return new OrderedMapType( role, propertyRef, embedded );
|
||||
public CollectionType set(String role, String propertyRef, boolean embedded) {
|
||||
return new SetType( typeScope, role, propertyRef, embedded );
|
||||
}
|
||||
|
||||
public static CollectionType set(String role, String propertyRef, boolean embedded) {
|
||||
return new SetType( role, propertyRef, embedded );
|
||||
public CollectionType orderedSet(String role, String propertyRef, boolean embedded) {
|
||||
return new OrderedSetType( typeScope, role, propertyRef, embedded );
|
||||
}
|
||||
|
||||
public static CollectionType orderedSet(String role, String propertyRef, boolean embedded) {
|
||||
return new OrderedSetType( role, propertyRef, 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 );
|
||||
public CollectionType sortedSet(String role, String propertyRef, boolean embedded, Comparator comparator) {
|
||||
return new SortedSetType( typeScope, role, propertyRef, comparator, embedded );
|
||||
}
|
||||
|
||||
|
||||
// convenience methods relating to operations across arrays of types ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// component type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* Deep copy a series of values from one array to another...
|
||||
*
|
||||
* @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 ComponentType component(ComponentMetamodel metamodel) {
|
||||
return new ComponentType( typeScope, metamodel );
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the {@link Type#beforeAssemble} operation across a series of values.
|
||||
*
|
||||
* @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 );
|
||||
public EmbeddedComponentType embeddedComponent(ComponentMetamodel metamodel) {
|
||||
return new EmbeddedComponentType( typeScope, metamodel );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
}
|
||||
// any type builder ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @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 );
|
||||
public Type any(Type metaType, Type identifierType) {
|
||||
return new AnyType( metaType, identifierType );
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 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 owner The entity "owning" the values
|
||||
*
|
||||
* @return The disassembled state
|
||||
*/
|
||||
public static Serializable[] disassemble(
|
||||
|
@ -157,6 +158,7 @@ public class TypeHelper {
|
|||
* @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
|
||||
*/
|
||||
public static Object[] replace(
|
||||
|
@ -189,6 +191,7 @@ public class TypeHelper {
|
|||
* @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
|
||||
*/
|
||||
public static Object[] replace(
|
||||
|
@ -213,11 +216,11 @@ public class TypeHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Apply the {@link Type#replace} operation across a series of values, as
|
||||
* long as the corresponding {@link Type} is an association.
|
||||
* 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.
|
||||
* 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.
|
||||
|
@ -274,6 +277,7 @@ public class TypeHelper {
|
|||
* @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.
|
||||
*/
|
||||
public static int[] findDirty(
|
||||
|
@ -321,6 +325,7 @@ public class TypeHelper {
|
|||
* @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.
|
||||
*/
|
||||
public static int[] findModified(
|
||||
|
|
|
@ -56,8 +56,16 @@ public class TypeResolver implements Serializable {
|
|||
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
|
||||
*
|
||||
|
|
|
@ -178,19 +178,19 @@ public class ValueVisitorTest extends UnitTestCase {
|
|||
|
||||
ValueVisitor vv = new ValueVisitorValidator();
|
||||
|
||||
new Any(mappings, tbl).accept(vv);
|
||||
new Array( rootClass ).accept(vv);
|
||||
new Bag( rootClass ).accept(vv);
|
||||
new Any( mappings, tbl ).accept(vv);
|
||||
new Array( mappings, rootClass ).accept(vv);
|
||||
new Bag( mappings, rootClass ).accept(vv);
|
||||
new Component( mappings, rootClass ).accept(vv);
|
||||
new DependantValue( mappings, tbl, null ).accept(vv);
|
||||
new IdentifierBag( rootClass ).accept(vv);
|
||||
new List( rootClass ).accept(vv);
|
||||
new IdentifierBag( mappings, rootClass ).accept(vv);
|
||||
new List( mappings, rootClass ).accept(vv);
|
||||
new ManyToOne( mappings, tbl ).accept(vv);
|
||||
new Map( rootClass ).accept(vv);
|
||||
new OneToMany( rootClass ).accept(vv);
|
||||
new Map( mappings, rootClass ).accept(vv);
|
||||
new OneToMany( mappings, rootClass ).accept(vv);
|
||||
new OneToOne( mappings, tbl, rootClass ).accept(vv);
|
||||
new PrimitiveArray( rootClass ).accept(vv);
|
||||
new Set( rootClass ).accept(vv);
|
||||
new PrimitiveArray( mappings, rootClass ).accept(vv);
|
||||
new Set( mappings, rootClass ).accept(vv);
|
||||
new SimpleValue( mappings ).accept(vv);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue