[hibernate-commits] Hibernate SVN: r19374 - in core/trunk: core/src/main/java/org/hibernate and 15 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed May 5 21:05:30 EDT 2010


Author: steve.ebersole at jboss.com
Date: 2010-05-05 21:05:26 -0400 (Wed, 05 May 2010)
New Revision: 19374

Added:
   core/trunk/core/src/main/java/org/hibernate/TypeHelper.java
   core/trunk/core/src/main/java/org/hibernate/impl/TypeLocatorImpl.java
Modified:
   core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/BagBinder.java
   core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
   core/trunk/core/src/main/java/org/hibernate/Hibernate.java
   core/trunk/core/src/main/java/org/hibernate/Session.java
   core/trunk/core/src/main/java/org/hibernate/SessionFactory.java
   core/trunk/core/src/main/java/org/hibernate/action/EntityUpdateAction.java
   core/trunk/core/src/main/java/org/hibernate/cache/StandardQueryCache.java
   core/trunk/core/src/main/java/org/hibernate/cache/entry/CacheEntry.java
   core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
   core/trunk/core/src/main/java/org/hibernate/cfg/HbmBinder.java
   core/trunk/core/src/main/java/org/hibernate/engine/TwoPhaseLoad.java
   core/trunk/core/src/main/java/org/hibernate/event/def/AbstractReassociateEventListener.java
   core/trunk/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java
   core/trunk/core/src/main/java/org/hibernate/event/def/DefaultDeleteEventListener.java
   core/trunk/core/src/main/java/org/hibernate/event/def/DefaultLoadEventListener.java
   core/trunk/core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java
   core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/FromElementType.java
   core/trunk/core/src/main/java/org/hibernate/hql/classic/PathExpressionParser.java
   core/trunk/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java
   core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
   core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java
   core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaJoinWalker.java
   core/trunk/core/src/main/java/org/hibernate/mapping/AbstractAuxiliaryDatabaseObject.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Any.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Array.java
   core/trunk/core/src/main/java/org/hibernate/mapping/AuxiliaryDatabaseObject.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Bag.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Column.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Component.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Constraint.java
   core/trunk/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java
   core/trunk/core/src/main/java/org/hibernate/mapping/DependantValue.java
   core/trunk/core/src/main/java/org/hibernate/mapping/FetchProfile.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Fetchable.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Filterable.java
   core/trunk/core/src/main/java/org/hibernate/mapping/ForeignKey.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Formula.java
   core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierBag.java
   core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierCollection.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Index.java
   core/trunk/core/src/main/java/org/hibernate/mapping/IndexedCollection.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Join.java
   core/trunk/core/src/main/java/org/hibernate/mapping/JoinedSubclass.java
   core/trunk/core/src/main/java/org/hibernate/mapping/KeyValue.java
   core/trunk/core/src/main/java/org/hibernate/mapping/List.java
   core/trunk/core/src/main/java/org/hibernate/mapping/ManyToOne.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Map.java
   core/trunk/core/src/main/java/org/hibernate/mapping/MappedSuperclass.java
   core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttributable.java
   core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttribute.java
   core/trunk/core/src/main/java/org/hibernate/mapping/OneToMany.java
   core/trunk/core/src/main/java/org/hibernate/mapping/OneToOne.java
   core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClass.java
   core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClassVisitor.java
   core/trunk/core/src/main/java/org/hibernate/mapping/PrimaryKey.java
   core/trunk/core/src/main/java/org/hibernate/mapping/PrimitiveArray.java
   core/trunk/core/src/main/java/org/hibernate/mapping/PropertyGeneration.java
   core/trunk/core/src/main/java/org/hibernate/mapping/RelationalModel.java
   core/trunk/core/src/main/java/org/hibernate/mapping/RootClass.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Selectable.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Set.java
   core/trunk/core/src/main/java/org/hibernate/mapping/SimpleAuxiliaryDatabaseObject.java
   core/trunk/core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Subclass.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Table.java
   core/trunk/core/src/main/java/org/hibernate/mapping/TableOwner.java
   core/trunk/core/src/main/java/org/hibernate/mapping/ToOne.java
   core/trunk/core/src/main/java/org/hibernate/mapping/TypeDef.java
   core/trunk/core/src/main/java/org/hibernate/mapping/UnionSubclass.java
   core/trunk/core/src/main/java/org/hibernate/mapping/UniqueKey.java
   core/trunk/core/src/main/java/org/hibernate/mapping/Value.java
   core/trunk/core/src/main/java/org/hibernate/mapping/ValueVisitor.java
   core/trunk/core/src/main/java/org/hibernate/mapping/package.html
   core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
   core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
   core/trunk/core/src/main/java/org/hibernate/type/ArrayType.java
   core/trunk/core/src/main/java/org/hibernate/type/BagType.java
   core/trunk/core/src/main/java/org/hibernate/type/CollectionType.java
   core/trunk/core/src/main/java/org/hibernate/type/ComponentType.java
   core/trunk/core/src/main/java/org/hibernate/type/CustomCollectionType.java
   core/trunk/core/src/main/java/org/hibernate/type/EmbeddedComponentType.java
   core/trunk/core/src/main/java/org/hibernate/type/EntityType.java
   core/trunk/core/src/main/java/org/hibernate/type/IdentifierBagType.java
   core/trunk/core/src/main/java/org/hibernate/type/ListType.java
   core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java
   core/trunk/core/src/main/java/org/hibernate/type/MapType.java
   core/trunk/core/src/main/java/org/hibernate/type/OneToOneType.java
   core/trunk/core/src/main/java/org/hibernate/type/OrderedMapType.java
   core/trunk/core/src/main/java/org/hibernate/type/OrderedSetType.java
   core/trunk/core/src/main/java/org/hibernate/type/SetType.java
   core/trunk/core/src/main/java/org/hibernate/type/SortedMapType.java
   core/trunk/core/src/main/java/org/hibernate/type/SortedSetType.java
   core/trunk/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java
   core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java
   core/trunk/core/src/main/java/org/hibernate/type/TypeHelper.java
   core/trunk/core/src/main/java/org/hibernate/type/TypeResolver.java
   core/trunk/testsuite/src/test/java/org/hibernate/test/mapping/ValueVisitorTest.java
Log:
HHH-5182 - Inject SessionFactory into "non-basic" Types


Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/BagBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/BagBinder.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/BagBinder.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -37,6 +37,6 @@
 	}
 
 	protected Collection createCollection(PersistentClass persistentClass) {
-		return new org.hibernate.mapping.Bag( persistentClass );
+		return new org.hibernate.mapping.Bag( getMappings(), persistentClass );
 	}
 }

Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -163,6 +163,10 @@
 	private AccessType accessType;
 	private boolean hibernateExtensionMapping;
 
+	protected ExtendedMappings getMappings() {
+		return mappings;
+	}
+
 	public boolean isMap() {
 		return false;
 	}
@@ -700,7 +704,7 @@
 	) {
 
 		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 );

Modified: core/trunk/core/src/main/java/org/hibernate/Hibernate.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/Hibernate.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/Hibernate.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -26,7 +26,6 @@
 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.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.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.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.MaterializedBlobType;
 import org.hibernate.type.ImageType;
 import org.hibernate.type.MaterializedClobType;
-import org.hibernate.usertype.CompositeUserType;
 
 /**
  * <ul>
@@ -281,83 +274,76 @@
 
 	/**
 	 * 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" );
 	}
 
 	/**

Modified: core/trunk/core/src/main/java/org/hibernate/Session.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/Session.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/Session.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -995,20 +995,26 @@
 	 */
 	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 @@
 		 * 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 @@
 		 * 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 @@
 		 * 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 @@
 		void lock(String entityName, Object object) throws HibernateException;
 
 		public void lock(Object object) throws HibernateException;
-	
 	}
-
 }

Modified: core/trunk/core/src/main/java/org/hibernate/SessionFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/SessionFactory.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/SessionFactory.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -386,4 +386,11 @@
 	 * @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();
 }

Added: core/trunk/core/src/main/java/org/hibernate/TypeHelper.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/TypeHelper.java	                        (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/TypeHelper.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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);
+}

Modified: core/trunk/core/src/main/java/org/hibernate/action/EntityUpdateAction.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/action/EntityUpdateAction.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/action/EntityUpdateAction.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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.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 @@
 			// 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(),

Modified: core/trunk/core/src/main/java/org/hibernate/cache/StandardQueryCache.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cache/StandardQueryCache.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/cache/StandardQueryCache.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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.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 @@
 		this.updateTimestampsCache = updateTimestampsCache;
 	}
 
+	@SuppressWarnings({ "UnnecessaryBoxing", "unchecked" })
 	public boolean put(
 			QueryKey key,
 			Type[] returnTypes,
@@ -88,7 +88,7 @@
 			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 @@
 
 			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 @@
 				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 @@
 				}
 				else {
 					result.add(
-							TypeFactory.assemble(
-									( Serializable[] ) cacheable.get( i ), returnTypes, session, null
-							)
+							TypeHelper.assemble( ( Serializable[] ) cacheable.get( i ), returnTypes, session, null )
 					);
 				}
 			}

Modified: core/trunk/core/src/main/java/org/hibernate/cache/entry/CacheEntry.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cache/entry/CacheEntry.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/cache/entry/CacheEntry.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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.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 @@
 			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 @@
 			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 @@
 				.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( 

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/Configuration.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -132,6 +132,7 @@
 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 @@
 		return typeResolver;
 	}
 
+	public void registerTypeOverride(BasicType type) {
+		getTypeResolver().registerTypeOverride( type );
+	}
+
 	public SessionFactoryObserver getSessionFactoryObserver() {
 		return sessionFactoryObserver;
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/cfg/HbmBinder.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/HbmBinder.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/HbmBinder.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -1440,7 +1440,7 @@
 
 		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 @@
 		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 @@
 		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 @@
 		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 @@
 		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 @@
 		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 @@
 		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 @@
 		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;
 			}

Modified: core/trunk/core/src/main/java/org/hibernate/engine/TwoPhaseLoad.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/TwoPhaseLoad.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/engine/TwoPhaseLoad.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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.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 @@
 		}
 		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);
 		}
 		

Modified: core/trunk/core/src/main/java/org/hibernate/event/def/AbstractReassociateEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/AbstractReassociateEventListener.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/AbstractReassociateEventListener.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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.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 @@
 
 		//get a snapshot
 		Object[] values = persister.getPropertyValues( object, source.getEntityMode() );
-		TypeFactory.deepCopy(
+		TypeHelper.deepCopy(
 				values,
 				persister.getPropertyTypes(),
 				persister.getPropertyUpdateability(),

Modified: core/trunk/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/AbstractSaveEventListener.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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.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 @@
 			persister.setPropertyValues( entity, values, source.getEntityMode() );
 		}
 
-		TypeFactory.deepCopy(
+		TypeHelper.deepCopy(
 				values,
 				types,
 				persister.getPropertyUpdateability(),

Modified: core/trunk/core/src/main/java/org/hibernate/event/def/DefaultDeleteEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/DefaultDeleteEventListener.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/DefaultDeleteEventListener.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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.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.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 @@
 //		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;
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/event/def/DefaultLoadEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/DefaultLoadEventListener.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/DefaultLoadEventListener.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -56,7 +56,7 @@
 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 @@
 
 		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 );

Modified: core/trunk/core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/event/def/DefaultMergeEventListener.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -55,8 +55,8 @@
 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 @@
 		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 @@
 			// 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 @@
 			);
 		}
 		else {
-			copiedValues = TypeFactory.replace(
+			copiedValues = TypeHelper.replace(
 					persister.getPropertyValues( entity, source.getEntityMode() ),
 					persister.getPropertyValues( target, source.getEntityMode() ),
 					persister.getPropertyTypes(),

Modified: core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/FromElementType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/FromElementType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/hql/ast/tree/FromElementType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -117,7 +117,10 @@
 	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 );
 	}
 
 	/**

Modified: core/trunk/core/src/main/java/org/hibernate/hql/classic/PathExpressionParser.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/classic/PathExpressionParser.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/hql/classic/PathExpressionParser.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -113,7 +113,7 @@
 		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;
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -662,7 +662,9 @@
 			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 @@
 			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++ ) {

Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -62,6 +62,7 @@
 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.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 @@
 	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 @@
 		};
 
 		this.typeResolver = cfg.getTypeResolver().scope( this );
+		this.typeHelper = new TypeLocatorImpl( typeResolver );
 
 		this.filters = new HashMap();
 		this.filters.putAll( cfg.getFilterDefinitions() );
@@ -1302,6 +1304,10 @@
 		return ( FetchProfile ) fetchProfiles.get( name );
 	}
 
+	public TypeHelper getTypeHelper() {
+		return typeHelper;
+	}
+
 	/**
 	 * Custom serialization hook used during Session serialization.
 	 *

Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionImpl.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -66,6 +66,7 @@
 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 @@
 		}
 	}
 
+	/**
+	 * {@inheritDoc}
+	 */
+	public TypeHelper getTypeHelper() {
+		return getSessionFactory().getTypeHelper();
+	}
+
 	private class CoordinatingEntityNameResolver implements EntityNameResolver {
 		public String resolveEntityName(Object entity) {
 			String entityName = interceptor.getEntityName( entity );

Added: core/trunk/core/src/main/java/org/hibernate/impl/TypeLocatorImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/TypeLocatorImpl.java	                        (rev 0)
+++ core/trunk/core/src/main/java/org/hibernate/impl/TypeLocatorImpl.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 );
+	}
+}

Modified: core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaJoinWalker.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaJoinWalker.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/loader/criteria/CriteriaJoinWalker.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -109,7 +109,7 @@
 				);
 		}
 		else {
-			resultTypes = new Type[] { TypeFactory.manyToOne( persister.getEntityName() ) };
+			resultTypes = new Type[] { factory.getTypeResolver().getTypeFactory().manyToOne( persister.getEntityName() ) };
 
 			initAll( translator.getWhereCondition(), translator.getOrderBy(), LockOptions.NONE );
 		}

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/AbstractAuxiliaryDatabaseObject.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/AbstractAuxiliaryDatabaseObject.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/AbstractAuxiliaryDatabaseObject.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Any.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Any.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Any.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -55,7 +55,8 @@
 
 	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 )
 		);

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Array.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Array.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Array.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 CollectionType getDefaultCollectionType() throws MappingException {
-		return TypeFactory.array( getRole(), getReferencedPropertyName(), isEmbedded(), getElementClass() );
+		return getMappings().getTypeResolver()
+				.getTypeFactory()
+				.array( getRole(), getReferencedPropertyName(), isEmbedded(), getElementClass() );
 	}
 
 	public boolean isArray() {

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/AuxiliaryDatabaseObject.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/AuxiliaryDatabaseObject.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/AuxiliaryDatabaseObject.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Bag.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Bag.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Bag.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 @@
  */
 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() {

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Collection.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 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 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 @@
 	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 @@
 
 	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 @@
 		return owner;
 	}
 
+	/**
+	 * @deprecated Inject the owner into constructor.
+	 *
+	 * @param owner The owner
+	 */
 	public void setOwner(PersistentClass owner) {
 		this.owner = owner;
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Column.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Column.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Column.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Component.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Component.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Component.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -183,10 +183,10 @@
 		// 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 );
 		}
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Constraint.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Constraint.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Constraint.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/DenormalizedTable.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/DependantValue.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/DependantValue.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/DependantValue.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/FetchProfile.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/FetchProfile.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/FetchProfile.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Fetchable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Fetchable.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Fetchable.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Filterable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Filterable.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Filterable.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/ForeignKey.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/ForeignKey.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/ForeignKey.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Formula.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Formula.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Formula.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierBag.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierBag.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierBag.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 @@
  */
 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) {

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierCollection.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierCollection.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/IdentifierCollection.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 @@
 
 	private KeyValue identifier;
 
-	public IdentifierCollection(PersistentClass owner) {
-		super(owner);
+	public IdentifierCollection(Mappings mappings, PersistentClass owner) {
+		super( mappings, owner );
 	}
 
 	public KeyValue getIdentifier() {

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Index.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Index.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Index.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/IndexedCollection.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/IndexedCollection.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/IndexedCollection.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 @@
 	private Value index;
 	private String indexNodeName;
 
-	public IndexedCollection(PersistentClass owner) {
-		super(owner);
+	public IndexedCollection(Mappings mappings, PersistentClass owner) {
+		super( mappings, owner );
 	}
 
 	public Value getIndex() {

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Join.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Join.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Join.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/JoinedSubclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/JoinedSubclass.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/JoinedSubclass.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/KeyValue.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/KeyValue.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/KeyValue.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/List.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/List.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/List.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 @@
 		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) {

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/ManyToOne.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/ManyToOne.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/ManyToOne.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 Type getType() throws MappingException {
-		return TypeFactory.manyToOne( 
+		return getMappings().getTypeResolver().getTypeFactory().manyToOne(
 				getReferencedEntityName(), 
 				getReferencedPropertyName(),
 				isLazy(),

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Map.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Map.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Map.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 @@
  */
 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 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() );
 		}
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/MappedSuperclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/MappedSuperclass.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/MappedSuperclass.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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.*;

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttributable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttributable.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttributable.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttribute.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttribute.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/MetaAttribute.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/OneToMany.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/OneToMany.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/OneToMany.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 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 @@
  */
 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();
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/OneToOne.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/OneToOne.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/OneToOne.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 Type getType() throws MappingException {
 		if ( getColumnIterator().hasNext() ) {
-			return new SpecialOneToOneType(
+			return getMappings().getTypeResolver().getTypeFactory().specialOneToOne(
 					getReferencedEntityName(), 
 					foreignKeyType, 
 					referencedPropertyName,
@@ -79,10 +78,10 @@
 					isUnwrapProxy(),
 					entityName,
 					propertyName
-				);
+			);
 		}
 		else {
-			return TypeFactory.oneToOne( 
+			return getMappings().getTypeResolver().getTypeFactory().oneToOne(
 					getReferencedEntityName(), 
 					foreignKeyType, 
 					referencedPropertyName,
@@ -91,7 +90,7 @@
 					isEmbedded(),
 					entityName,
 					propertyName
-				);
+			);
 		}
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClass.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClass.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClassVisitor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClassVisitor.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PersistentClassVisitor.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PrimaryKey.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PrimaryKey.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PrimaryKey.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PrimitiveArray.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PrimitiveArray.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PrimitiveArray.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 @@
 		return visitor.accept(this);
 	}
 }
-
-
-
-
-
-
-

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/PropertyGeneration.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/PropertyGeneration.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/PropertyGeneration.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/RelationalModel.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/RelationalModel.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/RelationalModel.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/RootClass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/RootClass.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/RootClass.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Selectable.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Selectable.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Selectable.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Set.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Set.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Set.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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 @@
 		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 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() );
 		}
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/SimpleAuxiliaryDatabaseObject.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/SimpleAuxiliaryDatabaseObject.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/SimpleAuxiliaryDatabaseObject.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Subclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Subclass.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Subclass.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Table.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Table.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Table.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/TableOwner.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/TableOwner.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/TableOwner.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/ToOne.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/ToOne.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/ToOne.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/TypeDef.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/TypeDef.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/TypeDef.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/UnionSubclass.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/UnionSubclass.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/UnionSubclass.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/UniqueKey.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/UniqueKey.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/UniqueKey.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/Value.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/Value.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/Value.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/ValueVisitor.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/ValueVisitor.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/ValueVisitor.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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;
 

Modified: core/trunk/core/src/main/java/org/hibernate/mapping/package.html
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/mapping/package.html	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/mapping/package.html	2010-05-06 01:05:26 UTC (rev 19374)
@@ -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>

Modified: core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -107,7 +107,7 @@
 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 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 int[] findModified(Object[] old, Object[] current, Object entity, SessionImplementor session)
 	throws HibernateException {
-		int[] props = TypeFactory.findModified(
+		int[] props = TypeHelper.findModified(
 				entityMetamodel.getProperties(),
 				current,
 				old,

Modified: core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -131,7 +131,7 @@
 
 		name = persistentClass.getEntityName();
 		rootName = persistentClass.getRootClass().getEntityName();
-		entityType = TypeFactory.manyToOne( name );
+		entityType = sessionFactory.getTypeResolver().getTypeFactory().manyToOne( name );
 
 		identifierProperty = PropertyFactory.buildIdentifierProperty(
 		        persistentClass,

Modified: core/trunk/core/src/main/java/org/hibernate/type/ArrayType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ArrayType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/ArrayType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -48,8 +48,8 @@
 	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();
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/type/BagType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/BagType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/BagType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -38,8 +38,8 @@
 
 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)

Modified: core/trunk/core/src/main/java/org/hibernate/type/CollectionType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/CollectionType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/CollectionType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -66,11 +66,13 @@
 	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;

Modified: core/trunk/core/src/main/java/org/hibernate/type/ComponentType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ComponentType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/ComponentType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -56,6 +56,7 @@
  */
 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 @@
 
 	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 @@
 				: 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 @@
 				target;
 
 		final EntityMode entityMode = session.getEntityMode();
-		Object[] values = TypeFactory.replace(
+		Object[] values = TypeHelper.replace(
 				getPropertyValues( original, entityMode ),
 				getPropertyValues( result, entityMode ),
 				propertyTypes,

Modified: core/trunk/core/src/main/java/org/hibernate/type/CustomCollectionType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/CustomCollectionType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/CustomCollectionType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -48,8 +48,13 @@
 	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() );

Modified: core/trunk/core/src/main/java/org/hibernate/type/EmbeddedComponentType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/EmbeddedComponentType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/EmbeddedComponentType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -40,8 +40,8 @@
 		return true;
 	}
 
-	public EmbeddedComponentType(ComponentMetamodel metamodel) {
-		super( metamodel );
+	public EmbeddedComponentType(TypeFactory.TypeScope typeScope, ComponentMetamodel metamodel) {
+		super( typeScope, metamodel );
 	}
 
 	public boolean isMethodOf(Method method) {

Modified: core/trunk/core/src/main/java/org/hibernate/type/EntityType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/EntityType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/EntityType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -55,6 +55,7 @@
  */
 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 @@
 	/**
 	 * 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 @@
 	 * 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 @@
 		this.unwrapProxy = unwrapProxy;
 	}
 
+	protected TypeFactory.TypeScope scope() {
+		return scope;
+	}
+
 	/**
 	 * An entity type is a type of association type
 	 *

Modified: core/trunk/core/src/main/java/org/hibernate/type/IdentifierBagType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/IdentifierBagType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/IdentifierBagType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -34,8 +34,8 @@
 
 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(

Modified: core/trunk/core/src/main/java/org/hibernate/type/ListType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ListType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/ListType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -37,8 +37,8 @@
 
 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) {

Modified: core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/ManyToOneType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -50,46 +50,35 @@
 	/**
 	 * 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 );
+	public ManyToOneType(TypeFactory.TypeScope scope, String referencedEntityName, boolean lazy) {
+		this( scope, referencedEntityName, null, lazy, true, false, false, false );
 	}
 
-	/**
-	 * @deprecated use {@link #ManyToOneType(String, String, boolean, boolean, boolean, boolean, boolean)}
-	 * @noinspection JavaDoc
-	 */
 	public ManyToOneType(
+			TypeFactory.TypeScope scope,
 			String referencedEntityName,
 			String uniqueKeyPropertyName,
 			boolean lazy,
 			boolean unwrapProxy,
 			boolean isEmbeddedInXML,
-			boolean ignoreNotFound) {
-		this( referencedEntityName, uniqueKeyPropertyName, lazy, unwrapProxy, isEmbeddedInXML, ignoreNotFound, false );
-	}
-
-	public ManyToOneType(
-			String referencedEntityName,
-			String uniqueKeyPropertyName,
-			boolean lazy,
-			boolean unwrapProxy,
-			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 @@
 	/**
 	 * 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 );
 			}
 		}
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/type/MapType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/MapType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/MapType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -40,8 +40,8 @@
 
 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) {

Modified: core/trunk/core/src/main/java/org/hibernate/type/OneToOneType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/OneToOneType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/OneToOneType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -45,6 +45,22 @@
 	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 @@
 		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
 	}

Modified: core/trunk/core/src/main/java/org/hibernate/type/OrderedMapType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/OrderedMapType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/OrderedMapType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -38,8 +38,8 @@
 	 * @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 );
 	}
 
 	/**

Modified: core/trunk/core/src/main/java/org/hibernate/type/OrderedSetType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/OrderedSetType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/OrderedSetType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -34,12 +34,13 @@
 	 * 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 );
 	}
 
 	/**

Modified: core/trunk/core/src/main/java/org/hibernate/type/SetType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SetType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/SetType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -36,8 +36,8 @@
 
 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) {

Modified: core/trunk/core/src/main/java/org/hibernate/type/SortedMapType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SortedMapType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/SortedMapType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -41,8 +41,8 @@
 
 	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;
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/type/SortedSetType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SortedSetType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/SortedSetType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -39,8 +39,8 @@
 
 	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;
 	}
 

Modified: core/trunk/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/SpecialOneToOneType.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -43,15 +43,16 @@
 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, 

Modified: core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/TypeFactory.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -25,7 +25,6 @@
 
 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.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 @@
 			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 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 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,8 +142,28 @@
 		}
 	}
 
-	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 );
 			return new CustomType( userType );
@@ -164,10 +186,9 @@
 	}
 
 
-	/**
-	 * 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 @@
 			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 @@
 			boolean ignoreNotFound,
 			boolean isLogicalOneToOne) {
 		return new ManyToOneType(
+				typeScope,
 				persistentClass,
 				uniqueKeyPropertyName,
 				lazy,
@@ -248,299 +244,64 @@
 		);
 	}
 
-	/**
-	 * 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 );
-	}
 
-	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;
-	}
+	// collection type builders ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-	// Collection Types:
-
-	public static CollectionType array(String role, String propertyRef, boolean embedded,
-			Class elementClass) {
-		return new ArrayType( role, propertyRef, elementClass, embedded );
+	public CollectionType array(String role, String propertyRef, boolean embedded, Class elementClass) {
+		return new ArrayType( typeScope, role, propertyRef, elementClass, embedded );
 	}
 
-	public static CollectionType list(String role, String propertyRef, boolean embedded) {
-		return new ListType( role, propertyRef, embedded );
+	public CollectionType list(String role, String propertyRef, boolean embedded) {
+		return new ListType( typeScope, role, propertyRef, embedded );
 	}
 
-	public static CollectionType bag(String role, String propertyRef, boolean embedded) {
-		return new BagType( role, propertyRef, embedded );
+	public CollectionType bag(String role, String propertyRef, boolean embedded) {
+		return new BagType( typeScope, role, propertyRef, embedded );
 	}
 
-	public static CollectionType idbag(String role, String propertyRef, boolean embedded) {
-		return new IdentifierBagType( role, propertyRef, embedded );
+	public CollectionType idbag(String role, String propertyRef, boolean embedded) {
+		return new IdentifierBagType( typeScope, role, propertyRef, embedded );
 	}
 
-	public static CollectionType map(String role, String propertyRef, boolean embedded) {
-		return new MapType( role, propertyRef, embedded );
+	public CollectionType map(String role, String propertyRef, boolean embedded) {
+		return new MapType( typeScope, role, propertyRef, embedded );
 	}
 
-	public static CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
-		return new OrderedMapType( role, propertyRef, embedded );
+	public CollectionType orderedMap(String role, String propertyRef, boolean embedded) {
+		return new OrderedMapType( typeScope, role, propertyRef, embedded );
 	}
 
-	public static CollectionType set(String role, String propertyRef, boolean embedded) {
-		return new SetType( 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 orderedSet(String role, String propertyRef, boolean embedded) {
-		return new OrderedSetType( role, propertyRef, embedded );
+	public CollectionType set(String role, String propertyRef, boolean embedded) {
+		return new SetType( typeScope, role, propertyRef, embedded );
 	}
 
-	public static CollectionType sortedMap(String role, String propertyRef, boolean embedded,
-			Comparator comparator) {
-		return new SortedMapType( role, propertyRef, comparator, embedded );
+	public CollectionType orderedSet(String role, String propertyRef, boolean embedded) {
+		return new OrderedSetType( typeScope, role, propertyRef, 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 );
-	}
-
 }

Modified: core/trunk/core/src/main/java/org/hibernate/type/TypeHelper.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/TypeHelper.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/TypeHelper.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -122,9 +122,10 @@
 	 *
 	 * @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 @@
 	 * @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 @@
 	 * @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 @@
 	}
 
 	/**
-	 * 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 @@
 	 * @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 @@
 	 * @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(

Modified: core/trunk/core/src/main/java/org/hibernate/type/TypeResolver.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/TypeResolver.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/core/src/main/java/org/hibernate/type/TypeResolver.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -56,8 +56,16 @@
 		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
 	 *

Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/mapping/ValueVisitorTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/mapping/ValueVisitorTest.java	2010-05-05 22:12:39 UTC (rev 19373)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/mapping/ValueVisitorTest.java	2010-05-06 01:05:26 UTC (rev 19374)
@@ -178,19 +178,19 @@
 
 		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);
 	
 		



More information about the hibernate-commits mailing list