[hibernate-commits] Hibernate SVN: r18924 - in core/trunk: annotations/src/main/java/org/hibernate/cfg and 6 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Mar 4 16:55:12 EST 2010


Author: hardy.ferentschik
Date: 2010-03-04 16:55:10 -0500 (Thu, 04 Mar 2010)
New Revision: 18924

Added:
   core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfile.java
   core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfiles.java
   core/trunk/annotations/src/main/java/org/hibernate/cfg/ConfigurationArtefactType.java
   core/trunk/annotations/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer2.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer3.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer4.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer5.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/FetchProfileTest.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Order.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/SupportTickets.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/package-info.java
   core/trunk/annotations/src/test/resources/org/hibernate/test/annotations/fetchprofile/
   core/trunk/annotations/src/test/resources/org/hibernate/test/annotations/fetchprofile/mappings.hbm.xml
Modified:
   core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
   core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java
   core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/any/package-info.java
   core/trunk/entitymanager/pom.xml
Log:
HHH-4812
Added @FetchProfile and @FetchProfiles annotations and wired them up. Added also some error handling in the AnnotationBinder.
Refactor the handling of precedence in the AnnotationConfiguration, because I thought I would be reusing it for the fetch profile as well, but in the end decided to jsut implement in a way that xml configured fetch profiles always win over annotation confgured ones.


Copied: core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfile.java (from rev 18918, core/trunk/annotations/src/main/java/org/hibernate/annotations/Fetch.java)
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfile.java	                        (rev 0)
+++ core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfile.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,55 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC 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.
+ *
+ * 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.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Define the fetching strategy profile.
+ *
+ * @author Hardy Ferentschik
+ */
+ at Target({ TYPE, PACKAGE })
+ at Retention(RUNTIME)
+public @interface FetchProfile {
+	String name();
+
+	FetchOverride[] fetchOverrides();
+
+	@Target({ TYPE, PACKAGE })
+	@Retention(RUNTIME)
+			@interface FetchOverride {
+		Class<?> entity();
+
+		String association();
+
+		FetchMode mode();
+	}
+}
\ No newline at end of file

Copied: core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfiles.java (from rev 18918, core/trunk/annotations/src/main/java/org/hibernate/annotations/Columns.java)
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfiles.java	                        (rev 0)
+++ core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfiles.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,41 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Target({ TYPE, PACKAGE })
+ at Retention(RUNTIME)
+public @interface FetchProfiles {
+	public abstract FetchProfile[] value();
+}
\ No newline at end of file


Property changes on: core/trunk/annotations/src/main/java/org/hibernate/annotations/FetchProfiles.java
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java	2010-03-04 18:15:19 UTC (rev 18923)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -38,9 +38,11 @@
 import java.util.Set;
 import javax.persistence.Basic;
 import javax.persistence.Cacheable;
+import javax.persistence.CollectionTable;
 import javax.persistence.Column;
 import javax.persistence.DiscriminatorType;
 import javax.persistence.DiscriminatorValue;
+import javax.persistence.ElementCollection;
 import javax.persistence.Embeddable;
 import javax.persistence.Embedded;
 import javax.persistence.EmbeddedId;
@@ -56,6 +58,9 @@
 import javax.persistence.ManyToMany;
 import javax.persistence.ManyToOne;
 import javax.persistence.MapKey;
+import javax.persistence.MapKeyColumn;
+import javax.persistence.MapKeyJoinColumn;
+import javax.persistence.MapKeyJoinColumns;
 import javax.persistence.MappedSuperclass;
 import javax.persistence.MapsId;
 import javax.persistence.NamedNativeQueries;
@@ -64,6 +69,7 @@
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
 import javax.persistence.OneToOne;
+import javax.persistence.OrderColumn;
 import javax.persistence.PrimaryKeyJoinColumn;
 import javax.persistence.PrimaryKeyJoinColumns;
 import javax.persistence.SequenceGenerator;
@@ -72,15 +78,12 @@
 import javax.persistence.SqlResultSetMappings;
 import javax.persistence.Table;
 import javax.persistence.TableGenerator;
+import javax.persistence.UniqueConstraint;
 import javax.persistence.Version;
-import javax.persistence.ElementCollection;
-import javax.persistence.CollectionTable;
-import javax.persistence.UniqueConstraint;
-import javax.persistence.MapKeyColumn;
-import javax.persistence.MapKeyJoinColumns;
-import javax.persistence.MapKeyJoinColumn;
-import javax.persistence.OrderColumn;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.hibernate.AnnotationException;
 import org.hibernate.AssertionFailure;
 import org.hibernate.EntityMode;
@@ -96,6 +99,8 @@
 import org.hibernate.annotations.CollectionOfElements;
 import org.hibernate.annotations.Columns;
 import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.FetchProfile;
+import org.hibernate.annotations.FetchProfiles;
 import org.hibernate.annotations.Filter;
 import org.hibernate.annotations.FilterDef;
 import org.hibernate.annotations.FilterDefs;
@@ -103,6 +108,7 @@
 import org.hibernate.annotations.ForeignKey;
 import org.hibernate.annotations.Formula;
 import org.hibernate.annotations.GenericGenerator;
+import org.hibernate.annotations.GenericGenerators;
 import org.hibernate.annotations.Index;
 import org.hibernate.annotations.LazyToOne;
 import org.hibernate.annotations.LazyToOneOption;
@@ -123,7 +129,6 @@
 import org.hibernate.annotations.TypeDef;
 import org.hibernate.annotations.TypeDefs;
 import org.hibernate.annotations.Where;
-import org.hibernate.annotations.GenericGenerators;
 import org.hibernate.annotations.common.reflection.ReflectionManager;
 import org.hibernate.annotations.common.reflection.XAnnotatedElement;
 import org.hibernate.annotations.common.reflection.XClass;
@@ -133,13 +138,13 @@
 import org.hibernate.cache.RegionFactory;
 import org.hibernate.cfg.annotations.CollectionBinder;
 import org.hibernate.cfg.annotations.EntityBinder;
+import org.hibernate.cfg.annotations.MapKeyColumnDelegator;
+import org.hibernate.cfg.annotations.MapKeyJoinColumnDelegator;
 import org.hibernate.cfg.annotations.Nullability;
 import org.hibernate.cfg.annotations.PropertyBinder;
 import org.hibernate.cfg.annotations.QueryBinder;
 import org.hibernate.cfg.annotations.SimpleValueBinder;
 import org.hibernate.cfg.annotations.TableBinder;
-import org.hibernate.cfg.annotations.MapKeyColumnDelegator;
-import org.hibernate.cfg.annotations.MapKeyJoinColumnDelegator;
 import org.hibernate.engine.FilterDefinition;
 import org.hibernate.engine.Versioning;
 import org.hibernate.id.MultipleHiLoPerTableGenerator;
@@ -167,22 +172,16 @@
 import org.hibernate.persister.entity.UnionSubclassEntityPersister;
 import org.hibernate.type.TypeFactory;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
- * JSR 175 annotation binder
- * Will read the annotation from classes, apply the
- * principles of the EJB3 spec and produces the Hibernate
- * configuration-time metamodel (the classes in the <tt>mapping</tt>
- * package)
+ * JSR 175 annotation binder which reads the annotations from classes, applies the
+ * principles of the EJB3 spec and produces the Hibernate configuration-time metamodel
+ * (the classes in the {@code org.hibernate.mapping} package)
  *
  * @author Emmanuel Bernard
  * @author Hardy Ferentschik
  */
 @SuppressWarnings("unchecked")
-public final class
-		AnnotationBinder {
+public final class AnnotationBinder {
 
 	/*
 	 * Some design description
@@ -197,6 +196,7 @@
 	 * makeSomething usually create the mapping container and is accessed by bindSomething[else]
 	 * fillSomething take the container into parameter and fill it.
 	 */
+
 	private AnnotationBinder() {
 	}
 
@@ -205,43 +205,47 @@
 	public static void bindDefaults(ExtendedMappings mappings) {
 		Map defaults = mappings.getReflectionManager().getDefaults();
 		{
-			List<SequenceGenerator> anns = (List<SequenceGenerator>) defaults.get( SequenceGenerator.class );
+			List<SequenceGenerator> anns = ( List<SequenceGenerator> ) defaults.get( SequenceGenerator.class );
 			if ( anns != null ) {
-				for (SequenceGenerator ann : anns) {
+				for ( SequenceGenerator ann : anns ) {
 					IdGenerator idGen = buildIdGenerator( ann, mappings );
-					if ( idGen != null ) mappings.addDefaultGenerator( idGen );
+					if ( idGen != null ) {
+						mappings.addDefaultGenerator( idGen );
+					}
 				}
 			}
 		}
 		{
-			List<TableGenerator> anns = (List<TableGenerator>) defaults.get( TableGenerator.class );
+			List<TableGenerator> anns = ( List<TableGenerator> ) defaults.get( TableGenerator.class );
 			if ( anns != null ) {
-				for (TableGenerator ann : anns) {
+				for ( TableGenerator ann : anns ) {
 					IdGenerator idGen = buildIdGenerator( ann, mappings );
-					if ( idGen != null ) mappings.addDefaultGenerator( idGen );
+					if ( idGen != null ) {
+						mappings.addDefaultGenerator( idGen );
+					}
 				}
 			}
 		}
 		{
-			List<NamedQuery> anns = (List<NamedQuery>) defaults.get( NamedQuery.class );
+			List<NamedQuery> anns = ( List<NamedQuery> ) defaults.get( NamedQuery.class );
 			if ( anns != null ) {
-				for (NamedQuery ann : anns) {
+				for ( NamedQuery ann : anns ) {
 					QueryBinder.bindQuery( ann, mappings, true );
 				}
 			}
 		}
 		{
-			List<NamedNativeQuery> anns = (List<NamedNativeQuery>) defaults.get( NamedNativeQuery.class );
+			List<NamedNativeQuery> anns = ( List<NamedNativeQuery> ) defaults.get( NamedNativeQuery.class );
 			if ( anns != null ) {
-				for (NamedNativeQuery ann : anns) {
+				for ( NamedNativeQuery ann : anns ) {
 					QueryBinder.bindNativeQuery( ann, mappings, true );
 				}
 			}
 		}
 		{
-			List<SqlResultSetMapping> anns = (List<SqlResultSetMapping>) defaults.get( SqlResultSetMapping.class );
+			List<SqlResultSetMapping> anns = ( List<SqlResultSetMapping> ) defaults.get( SqlResultSetMapping.class );
 			if ( anns != null ) {
-				for (SqlResultSetMapping ann : anns) {
+				for ( SqlResultSetMapping ann : anns ) {
 					QueryBinder.bindSqlResultsetMapping( ann, mappings, true );
 				}
 			}
@@ -253,7 +257,7 @@
 		try {
 			pckg = mappings.getReflectionManager().packageForName( packageName );
 		}
-		catch (ClassNotFoundException cnf) {
+		catch ( ClassNotFoundException cnf ) {
 			log.warn( "Package not found or wo package-info.java: {}", packageName );
 			return;
 		}
@@ -269,10 +273,11 @@
 			mappings.addGenerator( idGen );
 
 		}
-		bindGenericGenerators(pckg, mappings);
+		bindGenericGenerators( pckg, mappings );
 		bindQueries( pckg, mappings );
 		bindFilterDefs( pckg, mappings );
 		bindTypeDefs( pckg, mappings );
+		bindFetchProfiles( pckg, mappings );
 		BinderHelper.bindAnyMetaDefs( pckg, mappings );
 	}
 
@@ -283,7 +288,7 @@
 			bindGenericGenerator( defAnn, mappings );
 		}
 		if ( defsAnn != null ) {
-			for (GenericGenerator def : defsAnn.value() ) {
+			for ( GenericGenerator def : defsAnn.value() ) {
 				bindGenericGenerator( def, mappings );
 			}
 		}
@@ -302,7 +307,7 @@
 		{
 			SqlResultSetMappings ann = annotatedElement.getAnnotation( SqlResultSetMappings.class );
 			if ( ann != null ) {
-				for (SqlResultSetMapping current : ann.value()) {
+				for ( SqlResultSetMapping current : ann.value() ) {
 					QueryBinder.bindSqlResultsetMapping( current, mappings, false );
 				}
 			}
@@ -362,7 +367,7 @@
 			idGen = null;
 		}
 		else if ( ann instanceof TableGenerator ) {
-			TableGenerator tabGen = (TableGenerator) ann;
+			TableGenerator tabGen = ( TableGenerator ) ann;
 			idGen.setName( tabGen.name() );
 			if ( useNewGeneratorMappings ) {
 				idGen.setIdentifierGeneratorStrategy( org.hibernate.id.enhanced.TableGenerator.class.getName() );
@@ -378,17 +383,29 @@
 					idGen.addParam( org.hibernate.id.enhanced.TableGenerator.TABLE_PARAM, tabGen.table() );
 				}
 				if ( !BinderHelper.isDefault( tabGen.pkColumnName() ) ) {
-					idGen.addParam( org.hibernate.id.enhanced.TableGenerator.SEGMENT_COLUMN_PARAM, tabGen.pkColumnName() );
+					idGen.addParam(
+							org.hibernate.id.enhanced.TableGenerator.SEGMENT_COLUMN_PARAM, tabGen.pkColumnName()
+					);
 				}
 				if ( !BinderHelper.isDefault( tabGen.pkColumnValue() ) ) {
-					idGen.addParam( org.hibernate.id.enhanced.TableGenerator.SEGMENT_VALUE_PARAM, tabGen.pkColumnValue() );
+					idGen.addParam(
+							org.hibernate.id.enhanced.TableGenerator.SEGMENT_VALUE_PARAM, tabGen.pkColumnValue()
+					);
 				}
 				if ( !BinderHelper.isDefault( tabGen.valueColumnName() ) ) {
-					idGen.addParam( org.hibernate.id.enhanced.TableGenerator.VALUE_COLUMN_PARAM, tabGen.valueColumnName() );
+					idGen.addParam(
+							org.hibernate.id.enhanced.TableGenerator.VALUE_COLUMN_PARAM, tabGen.valueColumnName()
+					);
 				}
-				idGen.addParam( org.hibernate.id.enhanced.TableGenerator.INCREMENT_PARAM, String.valueOf( tabGen.allocationSize() ) );
+				idGen.addParam(
+						org.hibernate.id.enhanced.TableGenerator.INCREMENT_PARAM,
+						String.valueOf( tabGen.allocationSize() )
+				);
 				// See comment on HHH-4884 wrt initialValue.  Basically initialValue is really the stated value + 1
-				idGen.addParam( org.hibernate.id.enhanced.TableGenerator.INITIAL_PARAM, String.valueOf( tabGen.initialValue() + 1 ) );
+				idGen.addParam(
+						org.hibernate.id.enhanced.TableGenerator.INITIAL_PARAM,
+						String.valueOf( tabGen.initialValue() + 1 )
+				);
 				if ( tabGen.uniqueConstraints() != null && tabGen.uniqueConstraints().length > 0 ) {
 					log.warn( "Ignoring unique constraints specified on table generator [{}]", tabGen.name() );
 				}
@@ -424,7 +441,7 @@
 			log.trace( "Add table generator with name: {}", idGen.getName() );
 		}
 		else if ( ann instanceof SequenceGenerator ) {
-			SequenceGenerator seqGen = (SequenceGenerator) ann;
+			SequenceGenerator seqGen = ( SequenceGenerator ) ann;
 			idGen.setName( seqGen.name() );
 			if ( useNewGeneratorMappings ) {
 				idGen.setIdentifierGeneratorStrategy( SequenceStyleGenerator.class.getName() );
@@ -460,11 +477,11 @@
 			}
 		}
 		else if ( ann instanceof GenericGenerator ) {
-			GenericGenerator genGen = (GenericGenerator) ann;
+			GenericGenerator genGen = ( GenericGenerator ) ann;
 			idGen.setName( genGen.name() );
 			idGen.setIdentifierGeneratorStrategy( genGen.strategy() );
 			Parameter[] params = genGen.parameters();
-			for (Parameter parameter : params) {
+			for ( Parameter parameter : params ) {
 				idGen.addParam( parameter.name(), parameter.value() );
 			}
 			log.trace( "Add generic generator with name: {}", idGen.getName() );
@@ -476,12 +493,12 @@
 	}
 
 	/**
-	 * Bind a class having JSR175 annotations
-	 * The subclasses <b>have to</b> be binded after its mother class
+	 * Bind a class having JSR175 annotations. Subclasses <b>have to</b> be bound after its parent class.
 	 *
 	 * @param clazzToProcess entity to bind as {@code XClass} instance
 	 * @param inheritanceStatePerClass Meta data about the inheritance relationships for all mapped classes
 	 * @param mappings Mapping meta data
+	 *
 	 * @throws MappingException in case there is an configuration error
 	 */
 	public static void bindClass(
@@ -494,21 +511,24 @@
 		//Queries declared in MappedSuperclass should be usable in Subclasses
 		if ( AnnotatedClassType.EMBEDDABLE_SUPERCLASS.equals( classType ) ) {
 			bindQueries( clazzToProcess, mappings );
-			bindTypeDefs(clazzToProcess, mappings);
-			bindFilterDefs(clazzToProcess, mappings);
+			bindTypeDefs( clazzToProcess, mappings );
+			bindFilterDefs( clazzToProcess, mappings );
 		}
 
-		if( !isEntityClassType( clazzToProcess, classType ) ) {
+		if ( !isEntityClassType( clazzToProcess, classType ) ) {
 			return;
 		}
 
 		log.info( "Binding entity from annotated class: {}", clazzToProcess.getName() );
 
-		PersistentClass superEntity = getSuperEntity(clazzToProcess, inheritanceStatePerClass, mappings, inheritanceState);
+		PersistentClass superEntity = getSuperEntity(
+				clazzToProcess, inheritanceStatePerClass, mappings, inheritanceState
+		);
 
 		bindQueries( clazzToProcess, mappings );
 		bindFilterDefs( clazzToProcess, mappings );
 		bindTypeDefs( clazzToProcess, mappings );
+		bindFetchProfiles( clazzToProcess, mappings );
 		BinderHelper.bindAnyMetaDefs( clazzToProcess, mappings );
 
 		String schema = "";
@@ -523,7 +543,9 @@
 			uniqueConstraints = TableBinder.buildUniqueConstraintHolders( tabAnn.uniqueConstraints() );
 		}
 
-		Ejb3JoinColumn[] inheritanceJoinedColumns = makeInheritanceJoinColumns( clazzToProcess, mappings, inheritanceState, superEntity );
+		Ejb3JoinColumn[] inheritanceJoinedColumns = makeInheritanceJoinColumns(
+				clazzToProcess, mappings, inheritanceState, superEntity
+		);
 		Ejb3DiscriminatorColumn discriminatorColumn = null;
 		String discrimValue = null;
 		if ( InheritanceType.SINGLE_TABLE.equals( inheritanceState.getType() ) ) {
@@ -578,7 +600,7 @@
 
 		//Filters are not allowed on subclasses
 		if ( !inheritanceState.hasParents() ) {
-			bindFilters(clazzToProcess, entityBinder, mappings);
+			bindFilters( clazzToProcess, entityBinder, mappings );
 		}
 
 		entityBinder.bindEntity();
@@ -591,14 +613,16 @@
 			entityBinder.bindTable(
 					schema, catalog, table, uniqueConstraints,
 					constraints, inheritanceState.hasDenormalizedTable() ?
-					superEntity.getTable() :
-					null
+							superEntity.getTable() :
+							null
 			);
 		}
 		else {
 			if ( clazzToProcess.isAnnotationPresent( Table.class ) ) {
-				log.warn( "Illegal use of @Table in a subclass of a SINGLE_TABLE hierarchy: " + clazzToProcess
-						.getName() );
+				log.warn(
+						"Illegal use of @Table in a subclass of a SINGLE_TABLE hierarchy: " + clazzToProcess
+								.getName()
+				);
 			}
 		}
 
@@ -620,7 +644,7 @@
 		boolean onDeleteAppropriate = false;
 		if ( InheritanceType.JOINED.equals( inheritanceState.getType() ) && inheritanceState.hasParents() ) {
 			onDeleteAppropriate = true;
-			final JoinedSubclass jsc = (JoinedSubclass) persistentClass;
+			final JoinedSubclass jsc = ( JoinedSubclass ) persistentClass;
 			if ( persistentClass.getEntityPersisterClass() == null ) {
 				persistentClass.getRootClass().setEntityPersisterClass( JoinedSubclassEntityPersister.class );
 			}
@@ -652,7 +676,7 @@
 				if ( inheritanceState.hasSiblings() || !discriminatorColumn.isImplicit() ) {
 					//need a discriminator column
 					bindDiscriminatorToPersistentClass(
-							(RootClass) persistentClass,
+							( RootClass ) persistentClass,
 							discriminatorColumn,
 							entityBinder.getSecondaryTables(),
 							propertyHolder
@@ -695,7 +719,7 @@
 				mappings
 		);
 
-		if (!isIdClass) {
+		if ( !isIdClass ) {
 			entityBinder.setWrapIdsInEmbeddedComponents( elementsToProcess.getIdPropertyCount() > 1 );
 		}
 
@@ -712,11 +736,11 @@
 		);
 
 		if ( !inheritanceState.hasParents() ) {
-			final RootClass rootClass = (RootClass) persistentClass;
+			final RootClass rootClass = ( RootClass ) persistentClass;
 			mappings.addSecondPass( new CreateKeySecondPass( rootClass ) );
 		}
 		else {
-			superEntity.addSubclass( (Subclass) persistentClass );
+			superEntity.addSubclass( ( Subclass ) persistentClass );
 		}
 
 		mappings.addClass( persistentClass );
@@ -751,7 +775,7 @@
 
 		if ( missingIdProperties.size() != 0 ) {
 			StringBuilder missings = new StringBuilder();
-			for (String property : missingIdProperties) {
+			for ( String property : missingIdProperties ) {
 				missings.append( property ).append( ", " );
 			}
 			throw new AnnotationException(
@@ -771,7 +795,7 @@
 		 * In JPA 2, there is a shortcut if the id class is the Pk of the associated class pointed to by the id
 		 * it ought to be treated as an embedded and not a real IdClass (at least in the Hibernate's internal way
 		 */
-		XClass classWithIdClass = inheritanceState.getClassWithIdClass(false);
+		XClass classWithIdClass = inheritanceState.getClassWithIdClass( false );
 		if ( classWithIdClass != null ) {
 			IdClass idClass = classWithIdClass.getAnnotation( IdClass.class );
 			XClass compositeClass = mappings.getReflectionManager().toXClass( idClass.value() );
@@ -779,8 +803,8 @@
 					entityBinder.getPropertyAccessType(), "id", compositeClass
 			);
 			PropertyData baseInferredData = new PropertyPreloadedData(
-                  entityBinder.getPropertyAccessType(), "id", classWithIdClass
-            );
+					entityBinder.getPropertyAccessType(), "id", classWithIdClass
+			);
 			AccessType propertyAccessor = entityBinder.getPropertyAccessor( compositeClass );
 			//In JPA 2, there is a shortcut if the IdClass is the Pk of the associated class pointed to by the id
 			//it ought to be treated as an embedded and not a real IdClass (at least in the Hibernate's internal way
@@ -825,17 +849,17 @@
 					propertyAccessor, "_identifierMapper", compositeClass
 			);
 			Component mapper = fillComponent(
-				propertyHolder,
-				inferredData,
-				baseInferredData,
-				propertyAccessor,
-				false,
-				entityBinder,
-				true,
-				true,
-				false,
-				mappings,
-				inheritanceStatePerClass
+					propertyHolder,
+					inferredData,
+					baseInferredData,
+					propertyAccessor,
+					false,
+					entityBinder,
+					true,
+					true,
+					false,
+					mappings,
+					inheritanceStatePerClass
 			);
 			entityBinder.setIgnoreIdAnnotations( ignoreIdAnnotations );
 			persistentClass.setIdentifierMapper( mapper );
@@ -847,8 +871,8 @@
 							inheritanceStatePerClass,
 							mappings
 					);
-			if (superclass != null) {
-				superclass.setDeclaredIdentifierMapper(mapper);
+			if ( superclass != null ) {
+				superclass.setDeclaredIdentifierMapper( mapper );
 			}
 			else {
 				//we are for sure on the entity
@@ -867,7 +891,7 @@
 
 			Iterator properties = mapper.getPropertyIterator();
 			while ( properties.hasNext() ) {
-				idPropertiesIfIdClass.add( ( (Property) properties.next() ).getName() );
+				idPropertiesIfIdClass.add( ( ( Property ) properties.next() ).getName() );
 			}
 			return true;
 		}
@@ -889,7 +913,7 @@
 					inferredData, baseInferredData, propertyAccessor, mappings
 			);
 			final InheritanceState state = inheritanceStatePerClass.get( idPropertyOnBaseClass.getClassOrElement() );
-			if (state == null) {
+			if ( state == null ) {
 				return false; //while it is likely a user error, let's consider it is something that might happen
 			}
 			final XClass associatedClassWithIdClass = state.getClassWithIdClass( true );
@@ -962,7 +986,7 @@
 					mode = SharedCacheMode.valueOf( value.toString() );
 				}
 				catch ( Exception e ) {
-					log.debug( 
+					log.debug(
 							"Unable to resolve given mode name [" + value.toString()
 									+ "]; using UNSPECIFIED : " + e.toString()
 					);
@@ -985,7 +1009,7 @@
 			return;
 		}
 
-		if ( ! properties.containsKey( AnnotationConfiguration.DEFAULT_CACHE_CONCURRENCY_STRATEGY ) ) {
+		if ( !properties.containsKey( AnnotationConfiguration.DEFAULT_CACHE_CONCURRENCY_STRATEGY ) ) {
 			log.trace( "Given properties did not contain any default cache concurrency strategy setting" );
 			return;
 		}
@@ -1004,7 +1028,9 @@
 
 	private static CacheConcurrencyStrategy determineCacheConcurrencyStrategy(ExtendedMappings mappings) {
 		if ( DEFAULT_CACHE_CONCURRENCY_STRATEGY == null ) {
-			final RegionFactory cacheRegionFactory = SettingsFactory.createRegionFactory( mappings.getConfigurationProperties(), true );
+			final RegionFactory cacheRegionFactory = SettingsFactory.createRegionFactory(
+					mappings.getConfigurationProperties(), true
+			);
 			DEFAULT_CACHE_CONCURRENCY_STRATEGY = CacheConcurrencyStrategy.fromAccessType( cacheRegionFactory.getDefaultAccessType() );
 		}
 		return DEFAULT_CACHE_CONCURRENCY_STRATEGY;
@@ -1071,7 +1097,7 @@
 				int nbrOfInhJoinedColumns = jcsAnn.value().length;
 				PrimaryKeyJoinColumn jcAnn;
 				inheritanceJoinedColumns = new Ejb3JoinColumn[nbrOfInhJoinedColumns];
-				for (int colIndex = 0; colIndex < nbrOfInhJoinedColumns; colIndex++) {
+				for ( int colIndex = 0; colIndex < nbrOfInhJoinedColumns; colIndex++ ) {
 					jcAnn = jcsAnn.value()[colIndex];
 					inheritanceJoinedColumns[colIndex] = Ejb3JoinColumn.buildJoinColumn(
 							jcAnn, null, superEntity.getIdentifier(),
@@ -1084,7 +1110,7 @@
 				inheritanceJoinedColumns = new Ejb3JoinColumn[1];
 				inheritanceJoinedColumns[0] = Ejb3JoinColumn.buildJoinColumn(
 						jcAnn, null, superEntity.getIdentifier(),
-						(Map<String, Join>) null, (PropertyHolder) null, mappings
+						( Map<String, Join> ) null, ( PropertyHolder ) null, mappings
 				);
 			}
 			log.trace( "Subclass joined column(s) created" );
@@ -1099,7 +1125,9 @@
 	}
 
 	private static PersistentClass getSuperEntity(XClass clazzToProcess, Map<XClass, InheritanceState> inheritanceStatePerClass, ExtendedMappings mappings, InheritanceState inheritanceState) {
-		InheritanceState superEntityState = InheritanceState.getInheritanceStateOfSuperEntity( clazzToProcess, inheritanceStatePerClass );
+		InheritanceState superEntityState = InheritanceState.getInheritanceStateOfSuperEntity(
+				clazzToProcess, inheritanceStatePerClass
+		);
 		PersistentClass superEntity = superEntityState != null ?
 				mappings.getClass(
 						superEntityState.getClazz().getName()
@@ -1124,8 +1152,10 @@
 				) {
 			if ( AnnotatedClassType.NONE.equals( classType )
 					&& clazzToProcess.isAnnotationPresent( org.hibernate.annotations.Entity.class ) ) {
-				log.warn( "Class annotated @org.hibernate.annotations.Entity but not javax.persistence.Entity "
-						+ "(most likely a user error): {}", clazzToProcess.getName() );
+				log.warn(
+						"Class annotated @org.hibernate.annotations.Entity but not javax.persistence.Entity "
+								+ "(most likely a user error): {}", clazzToProcess.getName()
+				);
 			}
 			return false;
 		}
@@ -1144,16 +1174,17 @@
 	 * Process the filters defined on the given class, as well as all filters defined
 	 * on the MappedSuperclass(s) in the inheritance hierarchy
 	 */
+
 	private static void bindFilters(XClass annotatedClass, EntityBinder entityBinder,
-			ExtendedMappings mappings) {
+									ExtendedMappings mappings) {
 
-		bindFilters(annotatedClass, entityBinder);
+		bindFilters( annotatedClass, entityBinder );
 
 		XClass classToProcess = annotatedClass.getSuperclass();
-		while (classToProcess != null) {
+		while ( classToProcess != null ) {
 			AnnotatedClassType classType = mappings.getClassType( classToProcess );
 			if ( AnnotatedClassType.EMBEDDABLE_SUPERCLASS.equals( classType ) ) {
-				bindFilters(classToProcess, entityBinder);
+				bindFilters( classToProcess, entityBinder );
 			}
 			classToProcess = classToProcess.getSuperclass();
 		}
@@ -1164,7 +1195,7 @@
 
 		Filters filtersAnn = annotatedElement.getAnnotation( Filters.class );
 		if ( filtersAnn != null ) {
-			for (Filter filter : filtersAnn.value()) {
+			for ( Filter filter : filtersAnn.value() ) {
 				entityBinder.addFilter( filter.name(), filter.condition() );
 			}
 		}
@@ -1182,7 +1213,7 @@
 			bindFilterDef( defAnn, mappings );
 		}
 		if ( defsAnn != null ) {
-			for (FilterDef def : defsAnn.value()) {
+			for ( FilterDef def : defsAnn.value() ) {
 				bindFilterDef( def, mappings );
 			}
 		}
@@ -1190,7 +1221,7 @@
 
 	private static void bindFilterDef(FilterDef defAnn, ExtendedMappings mappings) {
 		Map<String, org.hibernate.type.Type> params = new HashMap<String, org.hibernate.type.Type>();
-		for (ParamDef param : defAnn.parameters()) {
+		for ( ParamDef param : defAnn.parameters() ) {
 			params.put( param.name(), TypeFactory.heuristicType( param.type() ) );
 		}
 		FilterDefinition def = new FilterDefinition( defAnn.name(), defAnn.defaultCondition(), params );
@@ -1205,29 +1236,55 @@
 			bindTypeDef( defAnn, mappings );
 		}
 		if ( defsAnn != null ) {
-			for (TypeDef def : defsAnn.value()) {
+			for ( TypeDef def : defsAnn.value() ) {
 				bindTypeDef( def, mappings );
 			}
 		}
 	}
 
+	private static void bindFetchProfiles(XAnnotatedElement annotatedElement, ExtendedMappings mappings) {
+		FetchProfile fetchProfileAnnotation = annotatedElement.getAnnotation( FetchProfile.class );
+		FetchProfiles fetchProfileAnnotations = annotatedElement.getAnnotation( FetchProfiles.class );
+		if ( fetchProfileAnnotation != null ) {
+			bindFetchProfile( fetchProfileAnnotation, mappings );
+		}
+		if ( fetchProfileAnnotations != null ) {
+			for ( FetchProfile profile : fetchProfileAnnotations.value() ) {
+				bindFetchProfile( profile, mappings );
+			}
+		}
+	}
+
+	private static void bindFetchProfile(FetchProfile fetchProfileAnnotation, ExtendedMappings mappings) {
+		for ( FetchProfile.FetchOverride fetch : fetchProfileAnnotation.fetchOverrides() ) {
+			org.hibernate.annotations.FetchMode mode = fetch.mode();
+			if ( !mode.equals( org.hibernate.annotations.FetchMode.JOIN ) ) {
+				throw new MappingException( "Only FetchMode.JOIN is currently supported" );
+			}
+
+			SecondPass sp = new VerifyFetchProfileReferenceSecondPass( fetchProfileAnnotation.name(), fetch, mappings );
+			mappings.addSecondPass( sp );
+		}
+	}
+
 	private static void bindTypeDef(TypeDef defAnn, ExtendedMappings mappings) {
 		Properties params = new Properties();
-		for (Parameter param : defAnn.parameters()) {
+		for ( Parameter param : defAnn.parameters() ) {
 			params.setProperty( param.name(), param.value() );
 		}
 
-		if (BinderHelper.isDefault(defAnn.name()) && defAnn.defaultForType().equals(void.class)) {
+		if ( BinderHelper.isDefault( defAnn.name() ) && defAnn.defaultForType().equals( void.class ) ) {
 			throw new AnnotationException(
 					"Either name or defaultForType (or both) attribute should be set in TypeDef having typeClass " +
-					defAnn.typeClass().getName());
+							defAnn.typeClass().getName()
+			);
 		}
 
-		if (!BinderHelper.isDefault(defAnn.name())) {
+		if ( !BinderHelper.isDefault( defAnn.name() ) ) {
 			log.info( "Binding type definition: {}", defAnn.name() );
 			mappings.addTypeDef( defAnn.name(), defAnn.typeClass().getName(), params );
 		}
-		if (!defAnn.defaultForType().equals(void.class)) {
+		if ( !defAnn.defaultForType().equals( void.class ) ) {
 			log.info( "Binding type definition: {}", defAnn.defaultForType().getName() );
 			mappings.addTypeDef( defAnn.defaultForType().getName(), defAnn.typeClass().getName(), params );
 		}
@@ -1256,14 +1313,14 @@
 	}
 
 	/**
-	 *
 	 * @param elements List of {@code ProperyData} instances
 	 * @param defaultAccessType The default value access strategy which has to be used in case no explicit local access
-	 *        strategy is used
+	 * strategy is used
 	 * @param propertyContainer Metadata about a class and its properties
 	 * @param mappings Mapping meta data
+	 *
 	 * @return the number of id properties found while iterating the elements of {@code annotatedClass} using
-	 * the determined access strategy, {@code false} otherwise.
+	 *         the determined access strategy, {@code false} otherwise.
 	 */
 	static int addElementsOfClass(
 			List<PropertyData> elements, AccessType defaultAccessType, PropertyContainer propertyContainer, ExtendedMappings mappings
@@ -1295,7 +1352,8 @@
 		int idPropertyCounter = 0;
 		PropertyData propertyAnnotatedElement = new PropertyInferredData(
 				declaringClass, property, propertyAccessor,
-				mappings.getReflectionManager() );
+				mappings.getReflectionManager()
+		);
 
 		/*
 		 * put element annotated by @Id in front
@@ -1312,7 +1370,7 @@
 		else {
 			annElts.add( propertyAnnotatedElement );
 		}
-		if ( element.isAnnotationPresent( MapsId.class  ) ) {
+		if ( element.isAnnotationPresent( MapsId.class ) ) {
 			mappings.addPropertyAnnotatedWithMapsId( entity, propertyAnnotatedElement );
 		}
 
@@ -1322,6 +1380,7 @@
 	/*
 	 * Process annotation of a particular property
 	 */
+
 	private static void processElementAnnotations(
 			PropertyHolder propertyHolder, Nullability nullability,
 			PropertyData inferredData, HashMap<String, IdGenerator> classGenerators,
@@ -1350,7 +1409,7 @@
 								+ BinderHelper.getPath( propertyHolder, inferredData )
 				);
 			}
-			return ;
+			return;
 		}
 
 		ColumnsBuilder columnsBuilder = new ColumnsBuilder(
@@ -1376,7 +1435,7 @@
 		}
 		propertyBinder.setDeclaringClass( inferredData.getDeclaringClass() );
 		propertyBinder.setEntityBinder( entityBinder );
-		propertyBinder.setInheritanceStatePerClass(inheritanceStatePerClass);
+		propertyBinder.setInheritanceStatePerClass( inheritanceStatePerClass );
 
 		boolean isId = !entityBinder.isIgnoreIdAnnotations() &&
 				( property.isAnnotationPresent( Id.class )
@@ -1395,17 +1454,17 @@
 								+ propertyHolder.getEntityName()
 				);
 			}
-			if ( ! propertyHolder.isEntity() ) {
+			if ( !propertyHolder.isEntity() ) {
 				throw new AnnotationException(
 						"Unable to define @Version on an embedded class: "
 								+ propertyHolder.getEntityName()
 				);
 			}
 			log.trace( "{} is a version property", inferredData.getPropertyName() );
-			RootClass rootClass = (RootClass) propertyHolder.getPersistentClass();
+			RootClass rootClass = ( RootClass ) propertyHolder.getPersistentClass();
 			propertyBinder.setColumns( columns );
 			Property prop = propertyBinder.makePropertyValueAndBind();
-			propertyBinder.getSimpleValueBinder().setVersion(true);
+			propertyBinder.getSimpleValueBinder().setVersion( true );
 			rootClass.setVersion( prop );
 
 			//If version is on a mapped superclass, update the mapping
@@ -1414,20 +1473,20 @@
 					inheritanceStatePerClass,
 					mappings
 			);
-			if (superclass != null) {
-				superclass.setDeclaredVersion(prop);
+			if ( superclass != null ) {
+				superclass.setDeclaredVersion( prop );
 			}
 			else {
 				//we know the property is on the actual entity
 				rootClass.setDeclaredVersion( prop );
 			}
 
-			SimpleValue simpleValue = (SimpleValue) prop.getValue();
+			SimpleValue simpleValue = ( SimpleValue ) prop.getValue();
 			simpleValue.setNullValue( "undefined" );
 			rootClass.setOptimisticLockMode( Versioning.OPTIMISTIC_LOCK_VERSION );
 			log.trace(
 					"Version name: {}, unsavedValue: {}", rootClass.getVersion().getName(),
-					( (SimpleValue) rootClass.getVersion().getValue() ).getNullValue()
+					( ( SimpleValue ) rootClass.getVersion().getValue() ).getNullValue()
 			);
 		}
 		else {
@@ -1439,8 +1498,10 @@
 				//check validity
 				if ( property.isAnnotationPresent( Column.class )
 						|| property.isAnnotationPresent( Columns.class ) ) {
-					throw new AnnotationException( "@Column(s) not allowed on a @ManyToOne property: "
-							+ BinderHelper.getPath( propertyHolder, inferredData ) );
+					throw new AnnotationException(
+							"@Column(s) not allowed on a @ManyToOne property: "
+									+ BinderHelper.getPath( propertyHolder, inferredData )
+					);
 				}
 
 				Cascade hibernateCascade = property.getAnnotation( Cascade.class );
@@ -1451,13 +1512,13 @@
 				JoinTable assocTable = propertyHolder.getJoinTable( property );
 				if ( assocTable != null ) {
 					Join join = propertyHolder.addJoin( assocTable, false );
-					for (Ejb3JoinColumn joinColumn : joinColumns) {
+					for ( Ejb3JoinColumn joinColumn : joinColumns ) {
 						joinColumn.setSecondaryTableName( join.getTable().getName() );
 					}
 				}
 				final boolean mandatory = !ann.optional() || forcePersist;
 				bindManyToOne(
-						getCascadeStrategy( ann.cascade(), hibernateCascade, false, forcePersist),
+						getCascadeStrategy( ann.cascade(), hibernateCascade, false, forcePersist ),
 						joinColumns,
 						!mandatory,
 						ignoreNotFound, onDeleteCascade,
@@ -1473,8 +1534,10 @@
 				//check validity
 				if ( property.isAnnotationPresent( Column.class )
 						|| property.isAnnotationPresent( Columns.class ) ) {
-					throw new AnnotationException( "@Column(s) not allowed on a @OneToOne property: "
-							+ BinderHelper.getPath( propertyHolder, inferredData ) );
+					throw new AnnotationException(
+							"@Column(s) not allowed on a @OneToOne property: "
+									+ BinderHelper.getPath( propertyHolder, inferredData )
+					);
 				}
 
 				//FIXME support a proper PKJCs
@@ -1488,14 +1551,14 @@
 				JoinTable assocTable = propertyHolder.getJoinTable( property );
 				if ( assocTable != null ) {
 					Join join = propertyHolder.addJoin( assocTable, false );
-					for (Ejb3JoinColumn joinColumn : joinColumns) {
+					for ( Ejb3JoinColumn joinColumn : joinColumns ) {
 						joinColumn.setSecondaryTableName( join.getTable().getName() );
 					}
 				}
 				//MapsId means the columns belong to the pk => not null
 				final boolean mandatory = !ann.optional() || forcePersist;
 				bindOneToOne(
-						getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval(), forcePersist),
+						getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval(), forcePersist ),
 						joinColumns,
 						!mandatory,
 						getFetchMode( ann.fetch() ),
@@ -1516,8 +1579,10 @@
 				//check validity
 				if ( property.isAnnotationPresent( Column.class )
 						|| property.isAnnotationPresent( Columns.class ) ) {
-					throw new AnnotationException( "@Column(s) not allowed on a @Any property: "
-							+ BinderHelper.getPath( propertyHolder, inferredData ) );
+					throw new AnnotationException(
+							"@Column(s) not allowed on a @Any property: "
+									+ BinderHelper.getPath( propertyHolder, inferredData )
+					);
 				}
 
 				Cascade hibernateCascade = property.getAnnotation( Cascade.class );
@@ -1526,14 +1591,22 @@
 				JoinTable assocTable = propertyHolder.getJoinTable( property );
 				if ( assocTable != null ) {
 					Join join = propertyHolder.addJoin( assocTable, false );
-					for (Ejb3JoinColumn joinColumn : joinColumns) {
+					for ( Ejb3JoinColumn joinColumn : joinColumns ) {
 						joinColumn.setSecondaryTableName( join.getTable().getName() );
 					}
 				}
-				bindAny( getCascadeStrategy( null, hibernateCascade, false, forcePersist), //@Any has not cascade attribute
-						joinColumns, onDeleteCascade, nullability,
-						propertyHolder, inferredData, entityBinder,
-						isIdentifierMapper, mappings );
+				bindAny(
+						getCascadeStrategy( null, hibernateCascade, false, forcePersist ),
+						//@Any has not cascade attribute
+						joinColumns,
+						onDeleteCascade,
+						nullability,
+						propertyHolder,
+						inferredData,
+						entityBinder,
+						isIdentifierMapper,
+						mappings
+				);
 			}
 			else if ( property.isAnnotationPresent( OneToMany.class )
 					|| property.isAnnotationPresent( ManyToMany.class )
@@ -1549,7 +1622,7 @@
 
 				if ( property.isAnnotationPresent( OrderColumn.class ) ) {
 					indexColumn = IndexColumn.buildColumnFromAnnotation(
-							property.getAnnotation(OrderColumn.class),
+							property.getAnnotation( OrderColumn.class ),
 							propertyHolder,
 							inferredData,
 							entityBinder.getSecondaryTables(),
@@ -1560,7 +1633,7 @@
 					//if @IndexColumn is not there, the generated IndexColumn is an implicit column and not used.
 					//so we can leave the legacy processing as the default
 					indexColumn = IndexColumn.buildColumnFromAnnotation(
-							property.getAnnotation(org.hibernate.annotations.IndexColumn.class),
+							property.getAnnotation( org.hibernate.annotations.IndexColumn.class ),
 							propertyHolder,
 							inferredData,
 							mappings
@@ -1571,8 +1644,8 @@
 						property,
 						!indexColumn.isImplicit(),
 						property.isAnnotationPresent( CollectionOfElements.class )
-						|| property.isAnnotationPresent( org.hibernate.annotations.MapKey.class )
-								// || property.isAnnotationPresent( ManyToAny.class )
+								|| property.isAnnotationPresent( org.hibernate.annotations.MapKey.class )
+						// || property.isAnnotationPresent( ManyToAny.class )
 				);
 				collectionBinder.setIndexColumn( indexColumn );
 				MapKey mapKeyAnn = property.getAnnotation( MapKey.class );
@@ -1600,7 +1673,9 @@
 				Ejb3Column[] elementColumns;
 				//do not use "element" if you are a JPA 2 @ElementCollection only for legacy Hibernate mappings
 				boolean isJPA2ForValueMapping = property.isAnnotationPresent( ElementCollection.class );
-				PropertyData virtualProperty = isJPA2ForValueMapping ? inferredData : new WrappedInferredData( inferredData, "element" );
+				PropertyData virtualProperty = isJPA2ForValueMapping ? inferredData : new WrappedInferredData(
+						inferredData, "element"
+				);
 				if ( property.isAnnotationPresent( Column.class ) || property.isAnnotationPresent(
 						Formula.class
 				) ) {
@@ -1643,14 +1718,14 @@
 						keyColumns = new Column[] { new MapKeyColumnDelegator( property.getAnnotation( MapKeyColumn.class ) ) };
 					}
 					else if ( property.isAnnotationPresent( org.hibernate.annotations.MapKey.class ) ) {
-						if ( isJPA2 == null) {
+						if ( isJPA2 == null ) {
 							isJPA2 = Boolean.FALSE;
 						}
 						keyColumns = property.getAnnotation( org.hibernate.annotations.MapKey.class ).columns();
 					}
 
 					//not explicitly legacy
-					if ( isJPA2 == null) {
+					if ( isJPA2 == null ) {
 						isJPA2 = Boolean.TRUE;
 					}
 
@@ -1677,7 +1752,8 @@
 					Boolean isJPA2 = null;
 					if ( property.isAnnotationPresent( MapKeyJoinColumns.class ) ) {
 						isJPA2 = Boolean.TRUE;
-						final MapKeyJoinColumn[] mapKeyJoinColumns = property.getAnnotation( MapKeyJoinColumns.class ).value();
+						final MapKeyJoinColumn[] mapKeyJoinColumns = property.getAnnotation( MapKeyJoinColumns.class )
+								.value();
 						joinKeyColumns = new JoinColumn[mapKeyJoinColumns.length];
 						int index = 0;
 						for ( MapKeyJoinColumn joinColumn : mapKeyJoinColumns ) {
@@ -1685,23 +1761,32 @@
 							index++;
 						}
 						if ( joinKeyColumns != null ) {
-							throw new AnnotationException( "@MapKeyJoinColumn and @MapKeyJoinColumns used on the same property: "
-									+ BinderHelper.getPath( propertyHolder, inferredData ) );
+							throw new AnnotationException(
+									"@MapKeyJoinColumn and @MapKeyJoinColumns used on the same property: "
+											+ BinderHelper.getPath( propertyHolder, inferredData )
+							);
 						}
 					}
 					else if ( property.isAnnotationPresent( MapKeyJoinColumn.class ) ) {
 						isJPA2 = Boolean.TRUE;
-						joinKeyColumns = new JoinColumn[] { new MapKeyJoinColumnDelegator( property.getAnnotation( MapKeyJoinColumn.class ) ) };
+						joinKeyColumns = new JoinColumn[] {
+								new MapKeyJoinColumnDelegator(
+										property.getAnnotation(
+												MapKeyJoinColumn.class
+										)
+								)
+						};
 					}
 					else if ( property.isAnnotationPresent( org.hibernate.annotations.MapKeyManyToMany.class ) ) {
-						if ( isJPA2 == null) {
+						if ( isJPA2 == null ) {
 							isJPA2 = Boolean.FALSE;
 						}
-						joinKeyColumns = property.getAnnotation( org.hibernate.annotations.MapKeyManyToMany.class ).joinColumns();
+						joinKeyColumns = property.getAnnotation( org.hibernate.annotations.MapKeyManyToMany.class )
+								.joinColumns();
 					}
 
 					//not explicitly legacy
-					if ( isJPA2 == null) {
+					if ( isJPA2 == null ) {
 						isJPA2 = Boolean.TRUE;
 					}
 
@@ -1732,7 +1817,7 @@
 				}
 				String mappedBy = null;
 				if ( oneToManyAnn != null ) {
-					for (Ejb3JoinColumn column : joinColumns) {
+					for ( Ejb3JoinColumn column : joinColumns ) {
 						if ( column.isSecondary() ) {
 							throw new NotYetImplementedException( "Collections having FK in secondary table" );
 						}
@@ -1743,13 +1828,16 @@
 							mappings.getReflectionManager().toXClass( oneToManyAnn.targetEntity() )
 					);
 					collectionBinder.setCascadeStrategy(
-							getCascadeStrategy( oneToManyAnn.cascade(), hibernateCascade, oneToManyAnn.orphanRemoval(), false) );
+							getCascadeStrategy(
+									oneToManyAnn.cascade(), hibernateCascade, oneToManyAnn.orphanRemoval(), false
+							)
+					);
 					collectionBinder.setOneToMany( true );
 				}
 				else if ( elementCollectionAnn != null
 						|| collectionOfElementsAnn != null //Hibernate legacy
 						) {
-					for (Ejb3JoinColumn column : joinColumns) {
+					for ( Ejb3JoinColumn column : joinColumns ) {
 						if ( column.isSecondary() ) {
 							throw new NotYetImplementedException( "Collections having FK in secondary table" );
 						}
@@ -1770,7 +1858,11 @@
 					collectionBinder.setTargetEntity(
 							mappings.getReflectionManager().toXClass( manyToManyAnn.targetEntity() )
 					);
-					collectionBinder.setCascadeStrategy( getCascadeStrategy( manyToManyAnn.cascade(), hibernateCascade, false, false) );
+					collectionBinder.setCascadeStrategy(
+							getCascadeStrategy(
+									manyToManyAnn.cascade(), hibernateCascade, false, false
+							)
+					);
 					collectionBinder.setOneToMany( false );
 				}
 				else if ( property.isAnnotationPresent( ManyToAny.class ) ) {
@@ -1778,7 +1870,7 @@
 					collectionBinder.setTargetEntity(
 							mappings.getReflectionManager().toXClass( void.class )
 					);
-					collectionBinder.setCascadeStrategy( getCascadeStrategy( null, hibernateCascade, false, false) );
+					collectionBinder.setCascadeStrategy( getCascadeStrategy( null, hibernateCascade, false, false ) );
 					collectionBinder.setOneToMany( false );
 				}
 				collectionBinder.setMappedBy( mappedBy );
@@ -1795,7 +1887,7 @@
 					collectionBinder.setUpdatable( false );
 				}
 				if ( property.isAnnotationPresent( CollectionId.class ) ) { //do not compute the generators unless necessary
-					HashMap<String, IdGenerator> localGenerators = (HashMap<String, IdGenerator>) classGenerators.clone();
+					HashMap<String, IdGenerator> localGenerators = ( HashMap<String, IdGenerator> ) classGenerators.clone();
 					localGenerators.putAll( buildLocalGenerators( property, mappings ) );
 					collectionBinder.setLocalGenerators( localGenerators );
 
@@ -1815,15 +1907,17 @@
 				boolean isOverridden = false;
 				if ( isId || propertyHolder.isOrWithinEmbeddedId() || propertyHolder.isInIdClass() ) {
 					//the associated entity could be using an @IdClass making the overridden property a component
-					final PropertyData overridingProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId( isId, propertyHolder, property.getName(), mappings );
-					if (overridingProperty != null) {
+					final PropertyData overridingProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId(
+							isId, propertyHolder, property.getName(), mappings
+					);
+					if ( overridingProperty != null ) {
 						isOverridden = true;
 						final InheritanceState state = inheritanceStatePerClass.get( overridingProperty.getClassOrElement() );
-						if (state != null) {
+						if ( state != null ) {
 							isComponent = isComponent || state.hasIdClassOrEmbeddedId();
 						}
 						//Get the new column
-						columns = columnsBuilder.overrideColumnFromMapperOrMapsIdProperty(isId);
+						columns = columnsBuilder.overrideColumnFromMapperOrMapsIdProperty( isId );
 					}
 				}
 
@@ -1835,7 +1929,7 @@
 
 				if ( isComponent ) {
 					String referencedEntityName = null;
-					if (isOverridden) {
+					if ( isOverridden ) {
 						final PropertyData mapsIdProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId(
 								isId, propertyHolder, property.getName(), mappings
 						);
@@ -1853,7 +1947,7 @@
 							isId,
 							inheritanceStatePerClass,
 							referencedEntityName,
-							isOverridden ? (Ejb3JoinColumn[]) columns : null
+							isOverridden ? ( Ejb3JoinColumn[] ) columns : null
 					);
 				}
 				else {
@@ -1868,14 +1962,14 @@
 					//implicit type will check basic types and Serializable classes
 					if ( isId || ( !optional && nullability != Nullability.FORCED_NULL ) ) {
 						//force columns to not null
-						for (Ejb3Column col : columns) {
+						for ( Ejb3Column col : columns ) {
 							col.forceNotNull();
 						}
 					}
 
 					propertyBinder.setLazy( lazy );
 					propertyBinder.setColumns( columns );
-					if (isOverridden) {
+					if ( isOverridden ) {
 						final PropertyData mapsIdProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId(
 								isId, propertyHolder, property.getName(), mappings
 						);
@@ -1885,27 +1979,27 @@
 					propertyBinder.makePropertyValueAndBind();
 
 				}
-				if (isOverridden) {
-						final PropertyData mapsIdProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId(
-								isId, propertyHolder, property.getName(), mappings
-						);
-						Map<String, IdGenerator> localGenerators = (HashMap<String, IdGenerator>) classGenerators.clone();
-						final IdGenerator foreignGenerator = new IdGenerator();
-						foreignGenerator.setIdentifierGeneratorStrategy( "assigned" );
-						foreignGenerator.setName( "Hibernate-local--foreign generator" );
-						foreignGenerator.setIdentifierGeneratorStrategy( "foreign" );
-						foreignGenerator.addParam( "property", mapsIdProperty.getPropertyName() );
-						localGenerators.put( foreignGenerator.getName(), foreignGenerator );
+				if ( isOverridden ) {
+					final PropertyData mapsIdProperty = BinderHelper.getPropertyOverriddenByMapperOrMapsId(
+							isId, propertyHolder, property.getName(), mappings
+					);
+					Map<String, IdGenerator> localGenerators = ( HashMap<String, IdGenerator> ) classGenerators.clone();
+					final IdGenerator foreignGenerator = new IdGenerator();
+					foreignGenerator.setIdentifierGeneratorStrategy( "assigned" );
+					foreignGenerator.setName( "Hibernate-local--foreign generator" );
+					foreignGenerator.setIdentifierGeneratorStrategy( "foreign" );
+					foreignGenerator.addParam( "property", mapsIdProperty.getPropertyName() );
+					localGenerators.put( foreignGenerator.getName(), foreignGenerator );
 
-						BinderHelper.makeIdGenerator(
-								(SimpleValue) propertyBinder.getValue(),
-								foreignGenerator.getIdentifierGeneratorStrategy(),
-								foreignGenerator.getName(),
-								mappings,
-								localGenerators
-						);
-					}
-				if (isId) {
+					BinderHelper.makeIdGenerator(
+							( SimpleValue ) propertyBinder.getValue(),
+							foreignGenerator.getIdentifierGeneratorStrategy(),
+							foreignGenerator.getName(),
+							mappings,
+							localGenerators
+					);
+				}
+				if ( isId ) {
 					//components and regular basic types create SimpleValue objects
 					final SimpleValue value = ( SimpleValue ) propertyBinder.getValue();
 					if ( !isOverridden ) {
@@ -1927,13 +2021,13 @@
 		if ( index != null ) {
 			if ( joinColumns != null ) {
 
-				for (Ejb3Column column : joinColumns) {
+				for ( Ejb3Column column : joinColumns ) {
 					column.addIndex( index, inSecondPass );
 				}
 			}
 			else {
 				if ( columns != null ) {
-					for (Ejb3Column column : columns) {
+					for ( Ejb3Column column : columns ) {
 						column.addIndex( index, inSecondPass );
 					}
 				}
@@ -1943,12 +2037,12 @@
 		NaturalId naturalIdAnn = property.getAnnotation( NaturalId.class );
 		if ( naturalIdAnn != null ) {
 			if ( joinColumns != null ) {
-				for (Ejb3Column column : joinColumns) {
+				for ( Ejb3Column column : joinColumns ) {
 					column.addUniqueKey( "_UniqueKey", inSecondPass );
 				}
 			}
 			else {
-				for (Ejb3Column column : columns) {
+				for ( Ejb3Column column : columns ) {
 					column.addUniqueKey( "_UniqueKey", inSecondPass );
 				}
 			}
@@ -1971,7 +2065,7 @@
 		XClass returnedClass = inferredData.getClassOrElement();
 		XProperty property = inferredData.getProperty();
 		//clone classGenerator and override with local values
-		HashMap<String, IdGenerator> localGenerators = (HashMap<String, IdGenerator>) classGenerators.clone();
+		HashMap<String, IdGenerator> localGenerators = ( HashMap<String, IdGenerator> ) classGenerators.clone();
 		localGenerators.putAll( buildLocalGenerators( property, mappings ) );
 
 		//manage composite related metadata
@@ -1986,7 +2080,9 @@
 		String generatorName = generatedValue != null ?
 				generatedValue.generator() :
 				BinderHelper.ANNOTATION_STRING_DEFAULT;
-		if ( isComponent ) generatorType = "assigned"; //a component must not have any generator
+		if ( isComponent ) {
+			generatorType = "assigned";
+		} //a component must not have any generator
 		BinderHelper.makeIdGenerator( idValue, generatorType, generatorName, mappings, localGenerators );
 
 		log.trace(
@@ -1995,6 +2091,7 @@
 	}
 
 	//TODO move that to collection binder?
+
 	private static void bindJoinedTableAssociation(
 			XProperty property, ExtendedMappings mappings, EntityBinder entityBinder,
 			CollectionBinder collectionBinder, PropertyHolder propertyHolder, PropertyData inferredData,
@@ -2016,7 +2113,7 @@
 			final JoinColumn[] inverseJoins;
 
 			//JPA 2 has priority
-			if (collectionTable != null) {
+			if ( collectionTable != null ) {
 				catalog = collectionTable.catalog();
 				schema = collectionTable.schema();
 				tableName = collectionTable.name();
@@ -2035,9 +2132,15 @@
 
 			collectionBinder.setExplicitAssociationTable( true );
 
-			if ( !BinderHelper.isDefault( schema ) ) associationTableBinder.setSchema( schema );
-			if ( !BinderHelper.isDefault( catalog ) ) associationTableBinder.setCatalog( catalog );
-			if ( !BinderHelper.isDefault( tableName ) ) associationTableBinder.setName( tableName );
+			if ( !BinderHelper.isDefault( schema ) ) {
+				associationTableBinder.setSchema( schema );
+			}
+			if ( !BinderHelper.isDefault( catalog ) ) {
+				associationTableBinder.setCatalog( catalog );
+			}
+			if ( !BinderHelper.isDefault( tableName ) ) {
+				associationTableBinder.setName( tableName );
+			}
 			associationTableBinder.setUniqueConstraints( uniqueConstraints );
 
 			//set check constaint in the second pass
@@ -2081,7 +2184,8 @@
 					comp,
 					referencedEntityName,
 					columns,
-					mappings);
+					mappings
+			);
 			mappings.addSecondPass( sp );
 		}
 		else {
@@ -2091,18 +2195,21 @@
 					false, mappings, inheritanceStatePerClass
 			);
 		}
-		if (isId) {
+		if ( isId ) {
 			comp.setKey( true );
 			if ( propertyHolder.getPersistentClass().getIdentifier() != null ) {
 				throw new AnnotationException(
 						comp.getComponentClassName()
-						+ " must not have @Id properties when used as an @EmbeddedId: "
-						+ BinderHelper.getPath( propertyHolder, inferredData ) );
+								+ " must not have @Id properties when used as an @EmbeddedId: "
+								+ BinderHelper.getPath( propertyHolder, inferredData )
+				);
 			}
 			if ( referencedEntityName == null && comp.getPropertySpan() == 0 ) {
-				throw new AnnotationException( comp.getComponentClassName()
-						+ " has no persistent id property: "
-						+ BinderHelper.getPath( propertyHolder, inferredData ) );
+				throw new AnnotationException(
+						comp.getComponentClassName()
+								+ " has no persistent id property: "
+								+ BinderHelper.getPath( propertyHolder, inferredData )
+				);
 			}
 		}
 		XProperty property = inferredData.getProperty();
@@ -2124,24 +2231,26 @@
 
 	public static Component fillComponent(
 			PropertyHolder propertyHolder, PropertyData inferredData,
-		    AccessType propertyAccessor, boolean isNullable,
+			AccessType propertyAccessor, boolean isNullable,
 			EntityBinder entityBinder,
 			boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass,
 			ExtendedMappings mappings, Map<XClass, InheritanceState> inheritanceStatePerClass
 	) {
 
-	   return fillComponent(propertyHolder, inferredData, null, propertyAccessor,
-			   isNullable, entityBinder, isComponentEmbedded, isIdentifierMapper, inSecondPass, mappings,
-			   inheritanceStatePerClass);
+		return fillComponent(
+				propertyHolder, inferredData, null, propertyAccessor,
+				isNullable, entityBinder, isComponentEmbedded, isIdentifierMapper, inSecondPass, mappings,
+				inheritanceStatePerClass
+		);
 	}
 
 	public static Component fillComponent(
-          PropertyHolder propertyHolder, PropertyData inferredData,
-		  PropertyData baseInferredData, //base inferred data correspond to the entity reproducing inferredData's properties (ie IdClass)
-		  AccessType propertyAccessor, boolean isNullable, EntityBinder entityBinder,
-          boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, ExtendedMappings mappings,
-		  Map<XClass, InheritanceState> inheritanceStatePerClass
-  ) {
+			PropertyHolder propertyHolder, PropertyData inferredData,
+			PropertyData baseInferredData, //base inferred data correspond to the entity reproducing inferredData's properties (ie IdClass)
+			AccessType propertyAccessor, boolean isNullable, EntityBinder entityBinder,
+			boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, ExtendedMappings mappings,
+			Map<XClass, InheritanceState> inheritanceStatePerClass
+	) {
 
 		/**
 		 * inSecondPass can only be used to apply right away the second pass of a composite-element
@@ -2163,21 +2272,21 @@
 		List<PropertyData> baseClassElements = null;
 		Map<String, PropertyData> orderedBaseClassElements = new HashMap<String, PropertyData>();
 		XClass baseReturnedClassOrElement;
-		if(baseInferredData != null) {
+		if ( baseInferredData != null ) {
 			baseClassElements = new ArrayList<PropertyData>();
 			baseReturnedClassOrElement = baseInferredData.getClassOrElement();
-			bindTypeDefs(baseReturnedClassOrElement, mappings);
+			bindTypeDefs( baseReturnedClassOrElement, mappings );
 			PropertyContainer propContainer = new PropertyContainer( baseReturnedClassOrElement, xClassProcessed );
 			addElementsOfClass( baseClassElements, propertyAccessor, propContainer, mappings );
-			for (PropertyData element : baseClassElements) {
+			for ( PropertyData element : baseClassElements ) {
 				orderedBaseClassElements.put( element.getPropertyName(), element );
 			}
 		}
 
 		//embeddable elements can have type defs
-		bindTypeDefs(returnedClassOrElement, mappings);
+		bindTypeDefs( returnedClassOrElement, mappings );
 		PropertyContainer propContainer = new PropertyContainer( returnedClassOrElement, xClassProcessed );
-		addElementsOfClass( classElements, propertyAccessor, propContainer, mappings);
+		addElementsOfClass( classElements, propertyAccessor, propContainer, mappings );
 
 		//add elements of the embeddable superclass
 		XClass superClass = xClassProcessed.getSuperclass();
@@ -2194,17 +2303,18 @@
 					final PropertyData idClassPropertyData = classElements.get( i );
 					final PropertyData entityPropertyData = orderedBaseClassElements.get( idClassPropertyData.getPropertyName() );
 					if ( propertyHolder.isInIdClass() ) {
-						if (entityPropertyData == null) {
-							throw new AnnotationException (
+						if ( entityPropertyData == null ) {
+							throw new AnnotationException(
 									"Property of @IdClass not found in entity "
 											+ baseInferredData.getPropertyClass().getName() + ": "
-											+ idClassPropertyData.getPropertyName() 
+											+ idClassPropertyData.getPropertyName()
 							);
 						}
 						final boolean hasXToOneAnnotation = entityPropertyData.getProperty()
 								.isAnnotationPresent( ManyToOne.class )
 								|| entityPropertyData.getProperty().isAnnotationPresent( OneToOne.class );
-						final boolean isOfDifferentType = ! entityPropertyData.getClassOrElement().equals( idClassPropertyData.getClassOrElement() );
+						final boolean isOfDifferentType = !entityPropertyData.getClassOrElement()
+								.equals( idClassPropertyData.getClassOrElement() );
 						if ( hasXToOneAnnotation && isOfDifferentType ) {
 							//don't replace here as we need to use the actual original return type
 							//the annotation overriding will be dealt with by a mechanism similar to @MapsId
@@ -2219,28 +2329,36 @@
 				}
 			}
 		}
-		for (PropertyData propertyAnnotatedElement : classElements) {
+		for ( PropertyData propertyAnnotatedElement : classElements ) {
 			processElementAnnotations(
 					subHolder, isNullable ?
-					Nullability.NO_CONSTRAINT :
-					Nullability.FORCED_NOT_NULL,
+							Nullability.NO_CONSTRAINT :
+							Nullability.FORCED_NOT_NULL,
 					propertyAnnotatedElement,
 					new HashMap<String, IdGenerator>(), entityBinder, isIdentifierMapper, isComponentEmbedded,
 					inSecondPass, mappings, inheritanceStatePerClass
 			);
-			
+
 			XProperty property = propertyAnnotatedElement.getProperty();
-			if(property.isAnnotationPresent(GeneratedValue.class) &&
-			      property.isAnnotationPresent(Id.class) ) {
-			   //clone classGenerator and override with local values
-			   Map<String, IdGenerator> localGenerators = new HashMap<String, IdGenerator>();
-			   localGenerators.putAll( buildLocalGenerators( property, mappings ) );
+			if ( property.isAnnotationPresent( GeneratedValue.class ) &&
+					property.isAnnotationPresent( Id.class ) ) {
+				//clone classGenerator and override with local values
+				Map<String, IdGenerator> localGenerators = new HashMap<String, IdGenerator>();
+				localGenerators.putAll( buildLocalGenerators( property, mappings ) );
 
-			   GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class );
-			   String generatorType = generatedValue != null ? generatorType( generatedValue.strategy(), mappings ) : "assigned";
-			   String generator = generatedValue != null ? generatedValue.generator() : BinderHelper.ANNOTATION_STRING_DEFAULT;
-                   
-			   BinderHelper.makeIdGenerator( (SimpleValue) comp.getProperty(property.getName()).getValue(), generatorType, generator, mappings, localGenerators);
+				GeneratedValue generatedValue = property.getAnnotation( GeneratedValue.class );
+				String generatorType = generatedValue != null ? generatorType(
+						generatedValue.strategy(), mappings
+				) : "assigned";
+				String generator = generatedValue != null ? generatedValue.generator() : BinderHelper.ANNOTATION_STRING_DEFAULT;
+
+				BinderHelper.makeIdGenerator(
+						( SimpleValue ) comp.getProperty( property.getName() ).getValue(),
+						generatorType,
+						generator,
+						mappings,
+						localGenerators
+				);
 			}
 
 		}
@@ -2263,14 +2381,14 @@
 		return comp;
 	}
 
-    private static void bindIdClass(
-          String generatorType, String generatorName, PropertyData inferredData,
-          PropertyData baseInferredData, Ejb3Column[] columns, PropertyHolder propertyHolder,
-          boolean isComposite,
-          AccessType propertyAccessor, EntityBinder entityBinder, boolean isEmbedded,
-          boolean isIdentifierMapper, ExtendedMappings mappings,
-		  Map<XClass, InheritanceState> inheritanceStatePerClass
-  ) {
+	private static void bindIdClass(
+			String generatorType, String generatorName, PropertyData inferredData,
+			PropertyData baseInferredData, Ejb3Column[] columns, PropertyHolder propertyHolder,
+			boolean isComposite,
+			AccessType propertyAccessor, EntityBinder entityBinder, boolean isEmbedded,
+			boolean isIdentifierMapper, ExtendedMappings mappings,
+			Map<XClass, InheritanceState> inheritanceStatePerClass
+	) {
 
 		/*
 		 * Fill simple value and property since and Id is a property
@@ -2282,7 +2400,7 @@
 							+ propertyHolder.getEntityName()
 			);
 		}
-		RootClass rootClass = (RootClass) persistentClass;
+		RootClass rootClass = ( RootClass ) persistentClass;
 		String persistentClassName = rootClass.getClassName();
 		SimpleValue id;
 		final String propertyName = inferredData.getPropertyName();
@@ -2292,7 +2410,7 @@
 					propertyHolder, inferredData, baseInferredData, propertyAccessor,
 					false, entityBinder, isEmbedded, isIdentifierMapper, false, mappings, inheritanceStatePerClass
 			);
-			Component componentId = (Component) id;
+			Component componentId = ( Component ) id;
 			componentId.setKey( true );
 			if ( rootClass.getIdentifier() != null ) {
 				throw new AnnotationException( componentId.getComponentClassName() + " must not have @Id properties when used as an @EmbeddedId" );
@@ -2307,7 +2425,7 @@
 		else {
 			//TODO I think this branch is never used. Remove.
 
-			for (Ejb3Column column : columns) {
+			for ( Ejb3Column column : columns ) {
 				column.forceNotNull(); //this is an id
 			}
 			SimpleValueBinder value = new SimpleValueBinder();
@@ -2338,8 +2456,8 @@
 					inheritanceStatePerClass,
 					mappings
 			);
-			if (superclass != null) {
-				superclass.setDeclaredIdentifierProperty(prop);
+			if ( superclass != null ) {
+				superclass.setDeclaredIdentifierProperty( prop );
 			}
 			else {
 				//we know the property is on the actual entity
@@ -2351,7 +2469,9 @@
 	private static PropertyData getUniqueIdPropertyFromBaseClass(PropertyData inferredData, PropertyData baseInferredData, AccessType propertyAccessor, ExtendedMappings mappings) {
 		List<PropertyData> baseClassElements = new ArrayList<PropertyData>();
 		XClass baseReturnedClassOrElement = baseInferredData.getClassOrElement();
-		PropertyContainer propContainer = new PropertyContainer( baseReturnedClassOrElement, inferredData.getPropertyClass() );
+		PropertyContainer propContainer = new PropertyContainer(
+				baseReturnedClassOrElement, inferredData.getPropertyClass()
+		);
 		addElementsOfClass( baseClassElements, propertyAccessor, propContainer, mappings );
 		//Id properties are on top and there is only one
 		final PropertyData idPropertyOnBaseClass = baseClassElements.get( 0 );
@@ -2359,9 +2479,11 @@
 	}
 
 	private static void setupComponentTuplizer(XProperty property, Component component) {
-		if ( property == null ) return;
+		if ( property == null ) {
+			return;
+		}
 		if ( property.isAnnotationPresent( Tuplizers.class ) ) {
-			for (Tuplizer tuplizer : property.getAnnotation( Tuplizers.class ).value()) {
+			for ( Tuplizer tuplizer : property.getAnnotation( Tuplizers.class ).value() ) {
 				EntityMode mode = EntityMode.parse( tuplizer.entityMode() );
 				component.addTuplizer( mode, tuplizer.impl().getName() );
 			}
@@ -2388,7 +2510,7 @@
 		if ( unique ) {
 			value.markAsLogicalOneToOne();
 		}
-		value.setReferencedEntityName( ToOneBinder.getReferenceEntityName(inferredData, targetEntity, mappings) );
+		value.setReferencedEntityName( ToOneBinder.getReferenceEntityName( inferredData, targetEntity, mappings ) );
 		final XProperty property = inferredData.getProperty();
 		defineFetchingStrategy( value, property );
 		//value.setFetchMode( fetchMode );
@@ -2396,13 +2518,13 @@
 		value.setCascadeDeleteEnabled( cascadeOnDelete );
 		//value.setLazy( fetchMode != FetchMode.JOIN );
 		if ( !optional ) {
-			for (Ejb3JoinColumn column : columns) {
+			for ( Ejb3JoinColumn column : columns ) {
 				column.setNullable( false );
 			}
 		}
 		if ( property.isAnnotationPresent( MapsId.class ) ) {
 			//read only
-			for (Ejb3JoinColumn column : columns) {
+			for ( Ejb3JoinColumn column : columns ) {
 				column.setInsertable( false );
 				column.setUpdatable( false );
 			}
@@ -2415,7 +2537,9 @@
 		String fkName = fk != null ?
 				fk.name() :
 				"";
-		if ( !BinderHelper.isDefault( fkName ) ) value.setForeignKeyName( fkName );
+		if ( !BinderHelper.isDefault( fkName ) ) {
+			value.setForeignKeyName( fkName );
+		}
 
 		String path = propertyHolder.getPath() + "." + propertyName;
 		FkSecondPass secondPass = new ToOneFkSecondPass(
@@ -2531,15 +2655,15 @@
 				Iterator idColumns = identifier.getColumnIterator();
 				List<String> idColumnNames = new ArrayList<String>();
 				org.hibernate.mapping.Column currentColumn;
-				if ( identifier.getColumnSpan() !=  joinColumns.length ) {
+				if ( identifier.getColumnSpan() != joinColumns.length ) {
 					mapToPK = false;
 				}
 				else {
 					while ( idColumns.hasNext() ) {
-						currentColumn = (org.hibernate.mapping.Column) idColumns.next();
+						currentColumn = ( org.hibernate.mapping.Column ) idColumns.next();
 						idColumnNames.add( currentColumn.getName() );
 					}
-					for (Ejb3JoinColumn col : joinColumns) {
+					for ( Ejb3JoinColumn col : joinColumns ) {
 						if ( !idColumnNames.contains( col.getMappingColumn().getName() ) ) {
 							mapToPK = false;
 							break;
@@ -2583,13 +2707,18 @@
 			PropertyHolder propertyHolder, PropertyData inferredData, EntityBinder entityBinder,
 			boolean isIdentifierMapper, ExtendedMappings mappings
 	) {
-		org.hibernate.annotations.Any anyAnn = inferredData.getProperty().getAnnotation( org.hibernate.annotations.Any.class );
+		org.hibernate.annotations.Any anyAnn = inferredData.getProperty()
+				.getAnnotation( org.hibernate.annotations.Any.class );
 		if ( anyAnn == null ) {
-			throw new AssertionFailure( "Missing @Any annotation: "
-					+ BinderHelper.getPath( propertyHolder, inferredData ) );
+			throw new AssertionFailure(
+					"Missing @Any annotation: "
+							+ BinderHelper.getPath( propertyHolder, inferredData )
+			);
 		}
-		Any value = BinderHelper.buildAnyValue( anyAnn.metaDef(), columns, anyAnn.metaColumn(), inferredData,
-				cascadeOnDelete, nullability, propertyHolder, entityBinder, anyAnn.optional(), mappings );
+		Any value = BinderHelper.buildAnyValue(
+				anyAnn.metaDef(), columns, anyAnn.metaColumn(), inferredData,
+				cascadeOnDelete, nullability, propertyHolder, entityBinder, anyAnn.optional(), mappings
+		);
 
 		PropertyBinder binder = new PropertyBinder();
 		binder.setName( inferredData.getPropertyName() );
@@ -2636,7 +2765,7 @@
 	private static EnumSet<CascadeType> convertToHibernateCascadeType(javax.persistence.CascadeType[] ejbCascades) {
 		EnumSet<CascadeType> hibernateCascadeSet = EnumSet.noneOf( CascadeType.class );
 		if ( ejbCascades != null && ejbCascades.length > 0 ) {
-			for (javax.persistence.CascadeType cascade : ejbCascades) {
+			for ( javax.persistence.CascadeType cascade : ejbCascades ) {
 				switch ( cascade ) {
 					case ALL:
 						hibernateCascadeSet.add( CascadeType.ALL );
@@ -2664,8 +2793,8 @@
 	}
 
 	private static String getCascadeStrategy(
-		javax.persistence.CascadeType[] ejbCascades, Cascade hibernateCascadeAnnotation,
-		boolean orphanRemoval, boolean forcePersist) {
+			javax.persistence.CascadeType[] ejbCascades, Cascade hibernateCascadeAnnotation,
+			boolean orphanRemoval, boolean forcePersist) {
 		EnumSet<CascadeType> hibernateCascadeSet = convertToHibernateCascadeType( ejbCascades );
 		CascadeType[] hibernateCascades = hibernateCascadeAnnotation == null ?
 				null :
@@ -2676,11 +2805,11 @@
 		}
 
 		if ( orphanRemoval ) {
-			hibernateCascadeSet.add(CascadeType.DELETE_ORPHAN);
-			hibernateCascadeSet.add(CascadeType.REMOVE);
+			hibernateCascadeSet.add( CascadeType.DELETE_ORPHAN );
+			hibernateCascadeSet.add( CascadeType.REMOVE );
 		}
-		if (forcePersist) {
-			hibernateCascadeSet.add(CascadeType.PERSIST);
+		if ( forcePersist ) {
+			hibernateCascadeSet.add( CascadeType.PERSIST );
 		}
 
 		StringBuilder cascade = new StringBuilder();
@@ -2765,6 +2894,7 @@
 	 * inheritance status of a class.
 	 *
 	 * @param orderedClasses Order list of all annotated entities and their mapped superclasses
+	 *
 	 * @return A map of {@code InheritanceState}s keyed against their {@code XClass}.
 	 */
 	public static Map<XClass, InheritanceState> buildInheritanceStates(
@@ -2774,20 +2904,24 @@
 		Map<XClass, InheritanceState> inheritanceStatePerClass = new HashMap<XClass, InheritanceState>(
 				orderedClasses.size()
 		);
-		for (XClass clazz : orderedClasses) {
+		for ( XClass clazz : orderedClasses ) {
 			InheritanceState superclassState = InheritanceState.getSuperclassInheritanceState(
-					clazz, inheritanceStatePerClass );
+					clazz, inheritanceStatePerClass
+			);
 			InheritanceState state = new InheritanceState( clazz, inheritanceStatePerClass, mappings );
 			if ( superclassState != null ) {
 				//the classes are ordered thus preventing an NPE
 				//FIXME if an entity has subclasses annotated @MappedSperclass wo sub @Entity this is wrong
 				superclassState.setHasSiblings( true );
 				InheritanceState superEntityState = InheritanceState.getInheritanceStateOfSuperEntity(
-						clazz, inheritanceStatePerClass );
+						clazz, inheritanceStatePerClass
+				);
 				state.setHasParents( superEntityState != null );
-				final boolean nonDefault = state.getType() != null && !InheritanceType.SINGLE_TABLE.equals( state.getType() );
+				final boolean nonDefault = state.getType() != null && !InheritanceType.SINGLE_TABLE
+						.equals( state.getType() );
 				if ( superclassState.getType() != null ) {
-					final boolean mixingStrategy = state.getType() != null && !state.getType().equals( superclassState.getType() );
+					final boolean mixingStrategy = state.getType() != null && !state.getType()
+							.equals( superclassState.getType() );
 					if ( nonDefault && mixingStrategy ) {
 						log.warn(
 								"Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: {}",
@@ -2802,8 +2936,7 @@
 		return inheritanceStatePerClass;
 	}
 
-	private static boolean hasAnnotationsOnIdClass(XClass idClass)
-	{
+	private static boolean hasAnnotationsOnIdClass(XClass idClass) {
 //		if(idClass.getAnnotation(Embeddable.class) != null)
 //			return true;
 

Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java	2010-03-04 18:15:19 UTC (rev 18923)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationConfiguration.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -33,7 +33,9 @@
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -55,10 +57,10 @@
 import org.dom4j.io.SAXReader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.xml.sax.ErrorHandler;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
-import org.xml.sax.ErrorHandler;
 
 import org.hibernate.AnnotationException;
 import org.hibernate.DuplicateMappingException;
@@ -68,12 +70,12 @@
 import org.hibernate.SessionFactory;
 import org.hibernate.annotations.AnyMetaDef;
 import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.common.AssertionFailure;
 import org.hibernate.annotations.common.reflection.MetadataProvider;
 import org.hibernate.annotations.common.reflection.MetadataProviderInjector;
 import org.hibernate.annotations.common.reflection.ReflectionManager;
 import org.hibernate.annotations.common.reflection.XClass;
 import org.hibernate.annotations.common.reflection.java.JavaReflectionManager;
-import org.hibernate.annotations.common.AssertionFailure;
 import org.hibernate.cfg.annotations.Version;
 import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider;
 import org.hibernate.cfg.beanvalidation.BeanValidationActivator;
@@ -84,15 +86,16 @@
 import org.hibernate.event.PreInsertEventListener;
 import org.hibernate.event.PreUpdateEventListener;
 import org.hibernate.mapping.Column;
+import org.hibernate.mapping.FetchProfile;
 import org.hibernate.mapping.IdGenerator;
 import org.hibernate.mapping.Join;
 import org.hibernate.mapping.PersistentClass;
 import org.hibernate.mapping.Table;
 import org.hibernate.mapping.UniqueKey;
+import org.hibernate.util.CollectionHelper;
 import org.hibernate.util.JoinedIterator;
 import org.hibernate.util.ReflectHelper;
 import org.hibernate.util.StringHelper;
-import org.hibernate.util.CollectionHelper;
 
 /**
  * Similar to the {@link Configuration} object but handles EJB3 and Hibernate
@@ -132,8 +135,9 @@
 		Version.touch(); //touch version
 	}
 
-	public static final String ARTEFACT = "hibernate.mapping.precedence";
-	public static final String DEFAULT_PRECEDENCE = "hbm, class";
+	public static final String ARTEFACT_PROCESSING_ORDER = "hibernate.mapping.precedence";
+	public static final ConfigurationArtefactType[] DEFAULT_ARTEFACT_PROCESSING_ORDER =
+			new ConfigurationArtefactType[] { ConfigurationArtefactType.HBM, ConfigurationArtefactType.CLASS };
 
 	private Map<String, IdGenerator> namedGenerators;
 	private Map<String, Map<String, Join>> joins;
@@ -152,13 +156,13 @@
 	private Map<String, Document> hbmEntities;
 	private List<CacheHolder> caches;
 	private List<Document> hbmDocuments; //user ordering matters, hence the list
-	private String precedence = null;
+	private List<ConfigurationArtefactType> configurationArtefactPrecedence;
 	private boolean inSecondPass = false;
 	private transient ReflectionManager reflectionManager;
 	private boolean isDefaultProcessed = false;
 	private boolean isValidatorNotPresentLogged;
-	private Map<XClass,Map<String,PropertyData>> propertiesAnnotatedWithMapsId;
-	private Map<XClass,Map<String,PropertyData>> propertiesAnnotatedWithIdAndToOne;
+	private Map<XClass, Map<String, PropertyData>> propertiesAnnotatedWithMapsId;
+	private Map<XClass, Map<String, PropertyData>> propertiesAnnotatedWithIdAndToOne;
 
 	public AnnotationConfiguration() {
 		super();
@@ -173,9 +177,10 @@
 	 * ordered list.
 	 *
 	 * @param original The list of all entities annotated with {@code @Entity} or {@code @MappedSuperclass}
+	 *
 	 * @return Ordered list of entities including superclasses for entities which have any. Class hierachies are
-	 * listed bottom up (starting from the top level base class). There is no indication in the list when a new class
-	 * (hierarchy) starts.
+	 *         listed bottom up (starting from the top level base class). There is no indication in the list when a new class
+	 *         (hierarchy) starts.
 	 */
 	protected List<XClass> orderAndFillHierarchy(List<XClass> original) {
 		List<XClass> copy = new ArrayList<XClass>( original );
@@ -226,6 +231,8 @@
 	 * @param persistentClass the mapped class
 	 *
 	 * @return the configuration object
+	 *
+	 * @throws MappingException in case there is a configuration error for the specified class
 	 */
 	public AnnotationConfiguration addAnnotatedClass(Class persistentClass) throws MappingException {
 		XClass persistentXClass = reflectionManager.toXClass( persistentClass );
@@ -240,11 +247,13 @@
 	}
 
 	/**
-	 * Read package level metadata
+	 * Read package level metadata.
 	 *
 	 * @param packageName java package name
 	 *
 	 * @return the configuration object
+	 *
+	 * @throws MappingException in case there is an error in the mapping data
 	 */
 	public AnnotationConfiguration addPackage(String packageName) throws MappingException {
 		log.info( "Mapping package {}", packageName );
@@ -297,11 +306,11 @@
 		namingStrategy = EJB3NamingStrategy.INSTANCE;
 		setEntityResolver( new EJB3DTDEntityResolver() );
 		anyMetaDefs = new HashMap<String, AnyMetaDef>();
-		propertiesAnnotatedWithMapsId = new HashMap<XClass, Map<String,PropertyData>>();
-		propertiesAnnotatedWithIdAndToOne = new HashMap<XClass, Map<String,PropertyData>>(); 
+		propertiesAnnotatedWithMapsId = new HashMap<XClass, Map<String, PropertyData>>();
+		propertiesAnnotatedWithIdAndToOne = new HashMap<XClass, Map<String, PropertyData>>();
 		reflectionManager = new JavaReflectionManager();
 		( ( MetadataProviderInjector ) reflectionManager ).setMetadataProvider( new JPAMetadataProvider() );
-
+		configurationArtefactPrecedence = Collections.emptyList();
 	}
 
 	@Override
@@ -327,7 +336,7 @@
 		if ( !isDefaultProcessed ) {
 			//use global delimiters if orm.xml declare it
 			final Object isDelimited = reflectionManager.getDefaults().get( "delimited-identifier" );
-			if (isDelimited != null && isDelimited == Boolean.TRUE) {
+			if ( isDelimited != null && isDelimited == Boolean.TRUE ) {
 				getProperties().put( Environment.GLOBALLY_QUOTED_IDENTIFIERS, "true" );
 			}
 
@@ -336,21 +345,19 @@
 		}
 
 		//process entities
-		if ( precedence == null ) {
-			precedence = getProperties().getProperty( ARTEFACT );
+		if ( configurationArtefactPrecedence.isEmpty()
+				&& StringHelper.isNotEmpty( getProperties().getProperty( ARTEFACT_PROCESSING_ORDER ) ) ) {
+			configurationArtefactPrecedence = parsePrecedence( getProperties().getProperty( ARTEFACT_PROCESSING_ORDER ) );
 		}
-		if ( precedence == null ) {
-			precedence = DEFAULT_PRECEDENCE;
+		if ( configurationArtefactPrecedence.isEmpty() ) {
+			configurationArtefactPrecedence = Arrays.asList( DEFAULT_ARTEFACT_PROCESSING_ORDER );
 		}
-		StringTokenizer precedences = new StringTokenizer( precedence, ",; ", false );
-		if ( !precedences.hasMoreElements() ) {
-			throw new MappingException( ARTEFACT + " cannot be empty: " + precedence );
+		configurationArtefactPrecedence = Collections.unmodifiableList( configurationArtefactPrecedence );
+
+		for ( ConfigurationArtefactType p : configurationArtefactPrecedence ) {
+			removeConflictedArtifact( p );
+			processArtifactsOfType( p );
 		}
-		while ( precedences.hasMoreElements() ) {
-			String artifact = ( String ) precedences.nextElement();
-			removeConflictedArtifact( artifact );
-			processArtifactsOfType( artifact );
-		}
 
 		int cacheNbr = caches.size();
 		for ( int index = 0; index < cacheNbr; index++ ) {
@@ -381,11 +388,9 @@
 			throw ( RuntimeException ) e.getCause();
 		}
 
-		Iterator<Map.Entry<Table,List<UniqueConstraintHolder>>> tables = uniqueConstraintHoldersByTable.entrySet().iterator();
-		while ( tables.hasNext() ) {
-			final Map.Entry<Table,List<UniqueConstraintHolder>> entry = tables.next();
-			final Table table = entry.getKey();
-			final List<UniqueConstraintHolder> uniqueConstraints = entry.getValue();
+		for ( Map.Entry<Table, List<UniqueConstraintHolder>> tableListEntry : uniqueConstraintHoldersByTable.entrySet() ) {
+			final Table table = tableListEntry.getKey();
+			final List<UniqueConstraintHolder> uniqueConstraints = tableListEntry.getValue();
 			int uniqueIndexPerTable = 0;
 			for ( UniqueConstraintHolder holder : uniqueConstraints ) {
 				uniqueIndexPerTable++;
@@ -607,8 +612,8 @@
 		}
 	}
 
-	private void processArtifactsOfType(String artifact) {
-		if ( "hbm".equalsIgnoreCase( artifact ) ) {
+	private void processArtifactsOfType(ConfigurationArtefactType p) {
+		if ( ConfigurationArtefactType.HBM.equals( p ) ) {
 			log.debug( "Process hbm files" );
 			for ( Document document : hbmDocuments ) {
 				super.add( document );
@@ -616,7 +621,7 @@
 			hbmDocuments.clear();
 			hbmEntities.clear();
 		}
-		else if ( "class".equalsIgnoreCase( artifact ) ) {
+		else if ( ConfigurationArtefactType.CLASS.equals( p ) ) {
 			log.debug( "Process annotated classes" );
 			//bind classes in the correct order calculating some inheritance state
 			List<XClass> orderedClasses = orderAndFillHierarchy( annotatedClasses );
@@ -633,13 +638,10 @@
 			annotatedClasses.clear();
 			annotatedClassEntities.clear();
 		}
-		else {
-			log.warn( "Unknown artifact: {}", artifact );
-		}
 	}
 
-	private void removeConflictedArtifact(String artifact) {
-		if ( "hbm".equalsIgnoreCase( artifact ) ) {
+	private void removeConflictedArtifact(ConfigurationArtefactType p) {
+		if ( ConfigurationArtefactType.HBM.equals( p ) ) {
 			for ( String entity : hbmEntities.keySet() ) {
 				if ( annotatedClassEntities.containsKey( entity ) ) {
 					annotatedClasses.remove( annotatedClassEntities.get( entity ) );
@@ -647,7 +649,7 @@
 				}
 			}
 		}
-		else if ( "class".equalsIgnoreCase( artifact ) ) {
+		else if ( ConfigurationArtefactType.CLASS.equals( p ) ) {
 			for ( String entity : annotatedClassEntities.keySet() ) {
 				if ( hbmEntities.containsKey( entity ) ) {
 					hbmDocuments.remove( hbmEntities.get( entity ) );
@@ -832,23 +834,19 @@
 	}
 
 	public void setPrecedence(String precedence) {
-		this.precedence = precedence;
+		this.configurationArtefactPrecedence = parsePrecedence( precedence );
 	}
 
-	private static class CacheHolder {
-		public CacheHolder(String role, String usage, String region, boolean isClass, boolean cacheLazy) {
-			this.role = role;
-			this.usage = usage;
-			this.region = region;
-			this.isClass = isClass;
-			this.cacheLazy = cacheLazy;
+	private List<ConfigurationArtefactType> parsePrecedence(String s) {
+		if ( StringHelper.isEmpty( s ) ) {
+			return Collections.emptyList();
 		}
-
-		public String role;
-		public String usage;
-		public String region;
-		public boolean isClass;
-		public boolean cacheLazy;
+		StringTokenizer precedences = new StringTokenizer( s, ",; ", false );
+		List<ConfigurationArtefactType> tmpPrecedences = new ArrayList<ConfigurationArtefactType>();
+		while ( precedences.hasMoreElements() ) {
+			tmpPrecedences.add( ConfigurationArtefactType.parsePrecedence( ( String ) precedences.nextElement() ) );
+		}
+		return tmpPrecedences;
 	}
 
 	@Override
@@ -860,11 +858,11 @@
 			  * - if it fails because of the version attribute mismatch, try and validate the document with orm_1_0.xsd
 			 */
 			List<SAXParseException> errors = new ArrayList<SAXParseException>();
-			SAXReader saxReader = new SAXReader( );
+			SAXReader saxReader = new SAXReader();
 			saxReader.setEntityResolver( getEntityResolver() );
-			saxReader.setErrorHandler( new ErrorLogger(errors) );
-			saxReader.setMergeAdjacentText(true);
-			saxReader.setValidation(true);
+			saxReader.setErrorHandler( new ErrorLogger( errors ) );
+			saxReader.setMergeAdjacentText( true );
+			saxReader.setValidation( true );
 
 			setValidationFor( saxReader, "orm_2_0.xsd" );
 
@@ -880,7 +878,7 @@
 				if ( e.getCause() == null || !( throwable instanceof SAXParseException ) ) {
 					throw new MappingException( "Could not parse JPA mapping document", e );
 				}
-				errors.add( (SAXParseException) throwable );
+				errors.add( ( SAXParseException ) throwable );
 			}
 
 			boolean isV1Schema = false;
@@ -889,11 +887,11 @@
 				final String errorMessage = exception.getMessage();
 				//does the error look like a schema mismatch?
 				isV1Schema = doc != null
-						&& errorMessage.contains("1.0")
-						&& errorMessage.contains("2.0")
-						&& errorMessage.contains("version");
+						&& errorMessage.contains( "1.0" )
+						&& errorMessage.contains( "2.0" )
+						&& errorMessage.contains( "version" );
 			}
-			if (isV1Schema) {
+			if ( isV1Schema ) {
 				//reparse with v1
 				errors.clear();
 				setValidationFor( saxReader, "orm_1_0.xsd" );
@@ -903,21 +901,21 @@
 				}
 				catch ( DocumentException e ) {
 					//oops asXML fails even if the core doc parses initially
-					throw new AssertionFailure("Error in DOM4J leads to a bug in Hibernate", e);
+					throw new AssertionFailure( "Error in DOM4J leads to a bug in Hibernate", e );
 				}
 
 			}
 			if ( errors.size() != 0 ) {
 				//report errors in exception
-				StringBuilder errorMessage = new StringBuilder( );
-				for (SAXParseException error : errors) {
-					errorMessage.append("Error parsing XML (line")
-								.append(error.getLineNumber())
-								.append(" : column ")
-								.append(error.getColumnNumber())
-								.append("): ")
-								.append(error.getMessage())
-								.append("\n");
+				StringBuilder errorMessage = new StringBuilder();
+				for ( SAXParseException error : errors ) {
+					errorMessage.append( "Error parsing XML (line" )
+							.append( error.getLineNumber() )
+							.append( " : column " )
+							.append( error.getColumnNumber() )
+							.append( "): " )
+							.append( error.getMessage() )
+							.append( "\n" );
 				}
 				throw new MappingException( "Invalid ORM mapping file.\n" + errorMessage.toString() );
 			}
@@ -934,25 +932,6 @@
 		}
 	}
 
-	private static class ErrorLogger implements ErrorHandler {
-		private List<SAXParseException> errors;
-
-		public ErrorLogger(List<SAXParseException> errors) {
-			this.errors = errors;
-		}
-
-		public void warning(SAXParseException exception) throws SAXException {
-			errors.add( exception );
-		}
-
-		public void error(SAXParseException exception) throws SAXException {
-			errors.add( exception );
-		}
-
-		public void fatalError(SAXParseException exception) throws SAXException {
-		}
-	}
-
 	private void setValidationFor(SAXReader saxReader, String xsd) {
 		try {
 			saxReader.setFeature( "http://apache.org/xml/features/validation/schema", true );
@@ -1267,11 +1246,19 @@
 	}
 
 	//not a public API
+
 	public ReflectionManager getReflectionManager() {
 		return reflectionManager;
 	}
 
 	protected class ExtendedMappingsImpl extends MappingsImpl implements ExtendedMappings {
+		private Boolean useNewGeneratorMappings;
+		private Collection<FetchProfile> annotationConfiguredProfile;
+
+		public ExtendedMappingsImpl() {
+			annotationConfiguredProfile = new ArrayList<FetchProfile>();
+		}
+
 		public void addDefaultGenerator(IdGenerator generator) {
 			this.addGenerator( generator );
 			defaultNamedGenerators.add( generator.getName() );
@@ -1288,7 +1275,7 @@
 
 		public void addPropertyAnnotatedWithMapsId(XClass entityType, PropertyData property) {
 			Map<String, PropertyData> map = propertiesAnnotatedWithMapsId.get( entityType );
-			if (map == null) {
+			if ( map == null ) {
 				map = new HashMap<String, PropertyData>();
 				propertiesAnnotatedWithMapsId.put( entityType, map );
 			}
@@ -1302,15 +1289,13 @@
 
 		public void addToOneAndIdProperty(XClass entityType, PropertyData property) {
 			Map<String, PropertyData> map = propertiesAnnotatedWithIdAndToOne.get( entityType );
-			if (map == null) {
+			if ( map == null ) {
 				map = new HashMap<String, PropertyData>();
 				propertiesAnnotatedWithIdAndToOne.put( entityType, map );
 			}
 			map.put( property.getPropertyName(), property );
 		}
 
-		private Boolean useNewGeneratorMappings;
-
 		@SuppressWarnings({ "UnnecessaryUnboxing" })
 		public boolean useNewGeneratorMappings() {
 			if ( useNewGeneratorMappings == null ) {
@@ -1382,6 +1367,7 @@
 		}
 
 		//FIXME should be private but is part of the ExtendedMapping contract
+
 		public AnnotatedClassType addClassType(XClass clazz) {
 			AnnotatedClassType type;
 			if ( clazz.isAnnotationPresent( Entity.class ) ) {
@@ -1420,16 +1406,10 @@
 			return deprecatedStructure;
 		}
 
-		/**
-		 * {@inheritDoc}
-		 */
 		public Map<Table, List<UniqueConstraintHolder>> getUniqueConstraintHoldersByTable() {
 			return uniqueConstraintHoldersByTable;
 		}
 
-		/**
-		 * {@inheritDoc}
-		 */
 		@SuppressWarnings({ "unchecked" })
 		public void addUniqueConstraints(Table table, List uniqueConstraints) {
 			List<UniqueConstraintHolder> constraintHolders = new ArrayList<UniqueConstraintHolder>(
@@ -1437,7 +1417,7 @@
 			);
 
 			int keyNameBase = determineCurrentNumberOfUniqueConstraintHolders( table );
-			for ( String[] columns : (List<String[]>)uniqueConstraints ) {
+			for ( String[] columns : ( List<String[]> ) uniqueConstraints ) {
 				final String keyName = "key" + keyNameBase++;
 				constraintHolders.add(
 						new UniqueConstraintHolder().setName( keyName ).setColumns( columns )
@@ -1453,9 +1433,6 @@
 					: currentHolders.size();
 		}
 
-		/**
-		 * {@inheritDoc}
-		 */
 		public void addUniqueConstraintHolders(Table table, List<UniqueConstraintHolder> uniqueConstraintHolders) {
 			List<UniqueConstraintHolder> holderList = getUniqueConstraintHoldersByTable().get( table );
 			if ( holderList == null ) {
@@ -1550,5 +1527,54 @@
 		public AnyMetaDef getAnyMetaDef(String name) {
 			return anyMetaDefs.get( name );
 		}
+
+		public void addAnnotationConfiguredFetchProfile(FetchProfile fetchProfile) {
+			annotationConfiguredProfile.add( fetchProfile );
+		}
+
+		public boolean containsAnnotationConfiguredFetchProfile(FetchProfile fetchProfile) {
+			for ( FetchProfile profile : annotationConfiguredProfile ) {
+				// we need reference equality there!!
+				if ( profile == fetchProfile ) {
+					return true;
+				}
+			}
+			return false;
+		}
 	}
+
+	private static class CacheHolder {
+		public CacheHolder(String role, String usage, String region, boolean isClass, boolean cacheLazy) {
+			this.role = role;
+			this.usage = usage;
+			this.region = region;
+			this.isClass = isClass;
+			this.cacheLazy = cacheLazy;
+		}
+
+		public String role;
+		public String usage;
+		public String region;
+		public boolean isClass;
+		public boolean cacheLazy;
+	}
+
+	private static class ErrorLogger implements ErrorHandler {
+		private List<SAXParseException> errors;
+
+		public ErrorLogger(List<SAXParseException> errors) {
+			this.errors = errors;
+		}
+
+		public void warning(SAXParseException exception) throws SAXException {
+			errors.add( exception );
+		}
+
+		public void error(SAXParseException exception) throws SAXException {
+			errors.add( exception );
+		}
+
+		public void fatalError(SAXParseException exception) throws SAXException {
+		}
+	}
 }

Added: core/trunk/annotations/src/main/java/org/hibernate/cfg/ConfigurationArtefactType.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/ConfigurationArtefactType.java	                        (rev 0)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/ConfigurationArtefactType.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,49 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.cfg;
+
+import org.hibernate.HibernateException;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public enum ConfigurationArtefactType {
+	HBM,
+	CLASS;
+
+	static ConfigurationArtefactType parsePrecedence(String s) {
+		if ( s.equalsIgnoreCase( "hbm" ) ) {
+			return HBM;
+		}
+		else if ( s.equalsIgnoreCase( "class" ) ) {
+			return CLASS;
+		}
+		else {
+			throw new HibernateException( "'" + s + "' - invalid value for precedence configuration." );
+		}
+	}
+}
+
+


Property changes on: core/trunk/annotations/src/main/java/org/hibernate/cfg/ConfigurationArtefactType.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java	2010-03-04 18:15:19 UTC (rev 18923)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -1,3 +1,4 @@
+// $Id:$
 /*
  * Hibernate, Relational Persistence for Idiomatic Java
  *
@@ -30,12 +31,12 @@
 import org.hibernate.AnnotationException;
 import org.hibernate.MappingException;
 import org.hibernate.annotations.AnyMetaDef;
-import org.hibernate.annotations.Cache;
 import org.hibernate.annotations.common.reflection.ReflectionManager;
 import org.hibernate.annotations.common.reflection.XClass;
 import org.hibernate.engine.NamedQueryDefinition;
 import org.hibernate.engine.NamedSQLQueryDefinition;
 import org.hibernate.engine.ResultSetMappingDefinition;
+import org.hibernate.mapping.FetchProfile;
 import org.hibernate.mapping.IdGenerator;
 import org.hibernate.mapping.Join;
 import org.hibernate.mapping.PersistentClass;
@@ -47,6 +48,7 @@
  * at least for named generators
  *
  * @author Emmanuel Bernard
+ * @author Hardy Ferentschik
  */
 public interface ExtendedMappings extends Mappings {
 
@@ -61,6 +63,7 @@
 	 * Retrieve the id-generator by name.
 	 *
 	 * @param name The generator name.
+	 *
 	 * @return The generator, or null.
 	 */
 	public IdGenerator getGenerator(String name);
@@ -71,6 +74,7 @@
 	 *
 	 * @param name generator name
 	 * @param localGenerators local generators
+	 *
 	 * @return the appropriate idgenerator or null if not found
 	 */
 	public IdGenerator getGenerator(String name, Map<String, IdGenerator> localGenerators);
@@ -95,6 +99,7 @@
 	 *
 	 * @param name generator name
 	 * @param localGeneratorTables local generator tables
+	 *
 	 * @return The properties, or null.
 	 */
 	public Properties getGeneratorTableProperties(String name, Map<String, Properties> localGeneratorTables);
@@ -103,6 +108,7 @@
 	 * Retrieve join metadata for a particular persistent entity.
 	 *
 	 * @param entityName The entity name
+	 *
 	 * @return The join metadata
 	 */
 	public Map<String, Join> getJoins(String entityName);
@@ -112,6 +118,7 @@
 	 *
 	 * @param persistentClass The persistent entity metadata.
 	 * @param joins The join metadata to add.
+	 *
 	 * @throws MappingException
 	 */
 	public void addJoins(PersistentClass persistentClass, Map<String, Join> joins);
@@ -120,6 +127,7 @@
 	 * Get and maintain a cache of class type.
 	 *
 	 * @param clazz The XClass mapping
+	 *
 	 * @return The class type.
 	 */
 	public AnnotatedClassType getClassType(XClass clazz);
@@ -129,6 +137,7 @@
 	 * Add a class type.
 	 *
 	 * @param clazz The XClass mapping.
+	 *
 	 * @return The class type.
 	 */
 	public AnnotatedClassType addClassType(XClass clazz);
@@ -170,7 +179,7 @@
 	public void addAnyMetaDef(AnyMetaDef defAnn) throws AnnotationException;
 
 	public AnyMetaDef getAnyMetaDef(String name);
-	
+
 	public boolean isInSecondPass();
 
 	/**
@@ -196,4 +205,16 @@
 	public PropertyData getPropertyAnnotatedWithIdAndToOne(XClass entityType, String propertyName);
 
 	void addToOneAndIdProperty(XClass entity, PropertyData property);
+
+	/**
+	 * Add the specified profile to the list of fetch profiles configured via annotations.
+	 *
+	 * @param fetchProfile the fetch profile
+	 */
+	void addAnnotationConfiguredFetchProfile(FetchProfile fetchProfile);
+
+	/**
+	 * @return {@true} if the provided fetch profile has been configured via xml, {@false otherwise}.
+	 */
+	boolean containsAnnotationConfiguredFetchProfile(FetchProfile fetchProfile);
 }
\ No newline at end of file


Property changes on: core/trunk/annotations/src/main/java/org/hibernate/cfg/ExtendedMappings.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Added: core/trunk/annotations/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java	                        (rev 0)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,73 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.cfg;
+
+import java.util.Map;
+
+import org.hibernate.MappingException;
+import org.hibernate.annotations.FetchProfile;
+import org.hibernate.mapping.PersistentClass;
+
+/**
+ * @author Hardy Ferentschik
+ */
+public class VerifyFetchProfileReferenceSecondPass implements SecondPass {
+
+	private String fetchProfileName;
+	private FetchProfile.FetchOverride fetch;
+	private ExtendedMappings mappings;
+
+	public VerifyFetchProfileReferenceSecondPass(String fetchProfileName, FetchProfile.FetchOverride fetch, ExtendedMappings mappings) {
+		this.fetchProfileName = fetchProfileName;
+		this.fetch = fetch;
+		this.mappings = mappings;
+	}
+
+	public void doSecondPass(Map persistentClasses) throws MappingException {
+		org.hibernate.mapping.FetchProfile profile = mappings.findOrCreateFetchProfile( fetchProfileName );
+		if ( skipProfile( profile ) ) {
+			return;
+		}
+
+		PersistentClass clazz = mappings.getClass( fetch.entity().getName() );
+		// throws MappingException in case the property does not exist
+		clazz.getProperty( fetch.association() );
+
+		profile.addFetch(
+				fetch.entity().getName(), fetch.association(), fetch.mode().toString().toLowerCase()
+		);
+	}
+
+	private boolean skipProfile(org.hibernate.mapping.FetchProfile profile) {
+		if ( mappings.containsAnnotationConfiguredFetchProfile( profile ) ) {
+			return false;
+		}
+
+		// if there are fetches they must come from xml. If there are xml profiles the annotations get ignored
+		return !profile.getFetches().isEmpty();
+	}
+}
+
+


Property changes on: core/trunk/annotations/src/main/java/org/hibernate/cfg/VerifyFetchProfileReferenceSecondPass.java
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java	2010-03-04 18:15:19 UTC (rev 18923)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -36,7 +36,7 @@
 		AnnotationConfiguration cfg = new AnnotationConfiguration();
 		cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
 		cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
-		cfg.setProperty( AnnotationConfiguration.ARTEFACT, "class, whatever" );
+		cfg.setProperty( AnnotationConfiguration.ARTEFACT_PROCESSING_ORDER, "class" );
 		SessionFactory sf = cfg.buildSessionFactory();
 		assertNotNull( sf );
 		Session s = sf.openSession();
@@ -85,7 +85,7 @@
 		AnnotationConfiguration cfg = new AnnotationConfiguration();
 		cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
 		cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
-		cfg.setProperty( AnnotationConfiguration.ARTEFACT, "class, hbm" );
+		cfg.setProperty( AnnotationConfiguration.ARTEFACT_PROCESSING_ORDER, "class, hbm" );
 		cfg.addAnnotatedClass( Boat.class );
 		SessionFactory sf = cfg.buildSessionFactory();
 		assertNotNull( sf );


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/ConfigurationTest.java
___________________________________________________________________
Name: svn:keywords
   - Date Revision Author Id
   + Id

Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/any/package-info.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/any/package-info.java	2010-03-04 18:15:19 UTC (rev 18923)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/any/package-info.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -1,4 +1,4 @@
-//$Id:
+// $Id:$
 @AnyMetaDefs(
 		@AnyMetaDef( name= "Property", metaType = "string", idType = "integer",
 			metaValues = {

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,92 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.test.annotations.fetchprofile;
+
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.annotations.FetchMode;
+import org.hibernate.annotations.FetchProfile;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+ at FetchProfile(name = "customer-with-orders", fetchOverrides = {
+		@FetchProfile.FetchOverride(entity = Customer.class, association = "orders", mode = FetchMode.JOIN)
+})
+public class Customer {
+	@Id
+	@GeneratedValue
+	private long id;
+
+	private String name;
+
+	private long customerNumber;
+
+	@OneToMany
+	private Set<Order> orders;
+
+	@OneToMany
+	private Set<SupportTickets> tickets;
+
+	public long getCustomerNumber() {
+		return customerNumber;
+	}
+
+	public void setCustomerNumber(long customerNumber) {
+		this.customerNumber = customerNumber;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Set<Order> getOrders() {
+		return orders;
+	}
+
+	public void setOrders(Set<Order> orders) {
+		this.orders = orders;
+	}
+}
+
+


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer2.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer2.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer2.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,88 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.test.annotations.fetchprofile;
+
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.annotations.FetchMode;
+import org.hibernate.annotations.FetchProfile;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+ at FetchProfile(name = "customer-with-orders", fetchOverrides = {
+		@FetchProfile.FetchOverride(entity = Customer2.class, association = "foo", mode = FetchMode.JOIN)
+})
+public class Customer2 {
+	@Id
+	@GeneratedValue
+	private long id;
+
+	private String name;
+
+	private long customerNumber;
+
+	@OneToMany
+	private Set<Order> orders;
+
+	public long getCustomerNumber() {
+		return customerNumber;
+	}
+
+	public void setCustomerNumber(long customerNumber) {
+		this.customerNumber = customerNumber;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Set<Order> getOrders() {
+		return orders;
+	}
+
+	public void setOrders(Set<Order> orders) {
+		this.orders = orders;
+	}
+}
\ No newline at end of file


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer2.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer3.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer3.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer3.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,88 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.test.annotations.fetchprofile;
+
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.annotations.FetchMode;
+import org.hibernate.annotations.FetchProfile;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+ at FetchProfile(name = "wrong-class-name", fetchOverrides = {
+		@FetchProfile.FetchOverride(entity = Order.class, association = "orders", mode = FetchMode.JOIN)
+})
+public class Customer3 {
+	@Id
+	@GeneratedValue
+	private long id;
+
+	private String name;
+
+	private long customerNumber;
+
+	@OneToMany
+	private Set<Order> orders;
+
+	public long getCustomerNumber() {
+		return customerNumber;
+	}
+
+	public void setCustomerNumber(long customerNumber) {
+		this.customerNumber = customerNumber;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Set<Order> getOrders() {
+		return orders;
+	}
+
+	public void setOrders(Set<Order> orders) {
+		this.orders = orders;
+	}
+}
\ No newline at end of file


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer3.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer4.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer4.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer4.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,88 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.test.annotations.fetchprofile;
+
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.annotations.FetchMode;
+import org.hibernate.annotations.FetchProfile;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+ at FetchProfile(name = "unsupported-fetch-mode", fetchOverrides = {
+		@FetchProfile.FetchOverride(entity = Customer4.class, association = "orders", mode = FetchMode.SELECT)
+})
+public class Customer4 {
+	@Id
+	@GeneratedValue
+	private long id;
+
+	private String name;
+
+	private long customerNumber;
+
+	@OneToMany
+	private Set<Order> orders;
+
+	public long getCustomerNumber() {
+		return customerNumber;
+	}
+
+	public void setCustomerNumber(long customerNumber) {
+		this.customerNumber = customerNumber;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Set<Order> getOrders() {
+		return orders;
+	}
+
+	public void setOrders(Set<Order> orders) {
+		this.orders = orders;
+	}
+}
\ No newline at end of file


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer4.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer5.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer5.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer5.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,88 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.test.annotations.fetchprofile;
+
+import java.util.Set;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+
+import org.hibernate.annotations.FetchMode;
+import org.hibernate.annotations.FetchProfile;
+
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+ at FetchProfile(name = "orders-profile", fetchOverrides = {
+		@FetchProfile.FetchOverride(entity = Customer5.class, association = "foo", mode = FetchMode.JOIN)
+})
+public class Customer5 {
+	@Id
+	@GeneratedValue
+	private long id;
+
+	private String name;
+
+	private long customerNumber;
+
+	@OneToMany
+	private Set<Order> orders;
+
+	public long getCustomerNumber() {
+		return customerNumber;
+	}
+
+	public void setCustomerNumber(long customerNumber) {
+		this.customerNumber = customerNumber;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Set<Order> getOrders() {
+		return orders;
+	}
+
+	public void setOrders(Set<Order> orders) {
+		this.orders = orders;
+	}
+}
\ No newline at end of file


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer5.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/FetchProfileTest.java (from rev 18918, core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fkcircularity/FkCircularityTest.java)
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/FetchProfileTest.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/FetchProfileTest.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,151 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.test.annotations.fetchprofile;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.hibernate.MappingException;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.engine.SessionFactoryImplementor;
+
+/**
+ * Test case for HHH-4812
+ *
+ * @author Hardy Ferentschik
+ */
+public class FetchProfileTest extends TestCase {
+
+	private Logger log = LoggerFactory.getLogger( FetchProfileTest.class );
+
+	public void testFetchProfileConfigured() {
+		AnnotationConfiguration config = new AnnotationConfiguration();
+		config.addAnnotatedClass( Customer.class );
+		config.addAnnotatedClass( Order.class );
+		config.addAnnotatedClass( SupportTickets.class );
+		SessionFactoryImplementor sessionImpl = ( SessionFactoryImplementor ) config.buildSessionFactory();
+
+		assertTrue(
+				"fetch profile not parsed properly",
+				sessionImpl.containsFetchProfileDefinition( "customer-with-orders" )
+		);
+		assertFalse(
+				"package info should not be parsed",
+				sessionImpl.containsFetchProfileDefinition( "package-profile-1" )
+		);
+	}
+
+	public void testWrongAssociationName() {
+		AnnotationConfiguration config = new AnnotationConfiguration();
+		config.addAnnotatedClass( Customer2.class );
+		config.addAnnotatedClass( Order.class );
+
+		try {
+			config.buildSessionFactory();
+			fail();
+		}
+		catch ( MappingException e ) {
+			log.trace( "success" );
+		}
+	}
+
+	public void testWrongClass() {
+		AnnotationConfiguration config = new AnnotationConfiguration();
+		config.addAnnotatedClass( Customer3.class );
+		config.addAnnotatedClass( Order.class );
+
+		try {
+			config.buildSessionFactory();
+			fail();
+		}
+		catch ( MappingException e ) {
+			log.trace( "success" );
+		}
+	}
+
+	public void testUnsupportedFetchMode() {
+		AnnotationConfiguration config = new AnnotationConfiguration();
+		config.addAnnotatedClass( Customer4.class );
+		config.addAnnotatedClass( Order.class );
+
+		try {
+			config.buildSessionFactory();
+			fail();
+		}
+		catch ( MappingException e ) {
+			log.trace( "success" );
+		}
+	}
+
+	public void testXmlOverride() {
+		AnnotationConfiguration config = new AnnotationConfiguration();
+		config.addAnnotatedClass( Customer5.class );
+		config.addAnnotatedClass( Order.class );
+		InputStream is = Thread.currentThread()
+				.getContextClassLoader()
+				.getResourceAsStream( "org/hibernate/test/annotations/fetchprofile/mappings.hbm.xml" );
+		config.addInputStream( is );
+		SessionFactoryImplementor sessionImpl = ( SessionFactoryImplementor ) config.buildSessionFactory();
+
+		assertTrue(
+				"fetch profile not parsed properly",
+				sessionImpl.containsFetchProfileDefinition( "orders-profile" )
+		);
+
+		// now the same with no xml
+		config = new AnnotationConfiguration();
+		config.addAnnotatedClass( Customer5.class );
+		config.addAnnotatedClass( Order.class );
+		try {
+			config.buildSessionFactory();
+			fail();
+		}
+		catch ( MappingException e ) {
+			log.trace( "success" );
+		}
+	}
+
+	public void testPackageConfiguredFetchProfile() {
+		AnnotationConfiguration config = new AnnotationConfiguration();
+		config.addAnnotatedClass( Customer.class );
+		config.addAnnotatedClass( Order.class );
+		config.addAnnotatedClass( SupportTickets.class );
+		config.addPackage( Customer.class.getPackage().getName() );
+		SessionFactoryImplementor sessionImpl = ( SessionFactoryImplementor ) config.buildSessionFactory();
+
+		assertTrue(
+				"fetch profile not parsed properly",
+				sessionImpl.containsFetchProfileDefinition( "package-profile-1" )
+		);
+		assertTrue(
+				"fetch profile not parsed properly",
+				sessionImpl.containsFetchProfileDefinition( "package-profile-2" )
+		);
+	}
+}
\ No newline at end of file

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Order.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Order.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Order.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,71 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.test.annotations.fetchprofile;
+
+import java.util.Date;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+public class Order {
+	@Id
+	@GeneratedValue
+	private long id;
+
+	private long orderNumber;
+
+	private Date deliveryDate;
+
+	public Date getDeliveryDate() {
+		return deliveryDate;
+	}
+
+	public void setDeliveryDate(Date deliveryDate) {
+		this.deliveryDate = deliveryDate;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public long getOrderNumber() {
+		return orderNumber;
+	}
+
+	public void setOrderNumber(long orderNumber) {
+		this.orderNumber = orderNumber;
+	}
+}
+
+


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Order.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/SupportTickets.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/SupportTickets.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/SupportTickets.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,70 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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.test.annotations.fetchprofile;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Hardy Ferentschik
+ */
+ at Entity
+public class SupportTickets {
+	@Id
+	@GeneratedValue
+	private long id;
+
+	private String description;
+
+	private String resolution;
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public String getResolution() {
+		return resolution;
+	}
+
+	public void setResolution(String resolution) {
+		this.resolution = resolution;
+	}
+}
+
+


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/SupportTickets.java
___________________________________________________________________
Name: svn:keywords
   + Id

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/package-info.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/package-info.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/package-info.java	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,41 @@
+// $Id:$
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC 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.
+ *
+ * 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
+ *
+ */
+ at FetchProfiles({
+		@FetchProfile(name = "package-profile-1", fetchOverrides = {
+				@FetchProfile.FetchOverride(entity = Customer.class, association = "orders", mode = FetchMode.JOIN)
+		}),
+		@FetchProfile(name = "package-profile-2", fetchOverrides = {
+				@FetchProfile.FetchOverride(entity = Customer.class, association = "tickets", mode = FetchMode.JOIN)
+		})
+})
+package org.hibernate.test.annotations.fetchprofile;
+
+import org.hibernate.annotations.FetchMode;
+import org.hibernate.annotations.FetchProfile;
+import org.hibernate.annotations.FetchProfiles;
+
+
+


Property changes on: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/package-info.java
___________________________________________________________________
Name: svn:keywords
   + Id

Copied: core/trunk/annotations/src/test/resources/org/hibernate/test/annotations/fetchprofile/mappings.hbm.xml (from rev 18922, core/trunk/testsuite/src/test/java/org/hibernate/test/fetchprofiles/join/Mappings.hbm.xml)
===================================================================
--- core/trunk/annotations/src/test/resources/org/hibernate/test/annotations/fetchprofile/mappings.hbm.xml	                        (rev 0)
+++ core/trunk/annotations/src/test/resources/org/hibernate/test/annotations/fetchprofile/mappings.hbm.xml	2010-03-04 21:55:10 UTC (rev 18924)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping
+        SYSTEM
+        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<!--
+  ~ Hibernate, Relational Persistence for Idiomatic Java
+  ~
+  ~ Copyright (c) 2008, Red Hat Middleware LLC 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.
+  ~
+  ~ 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
+  ~
+  -->
+
+<hibernate-mapping package="org.hibernate.test.annotations.fetchprofile">
+    <fetch-profile name="orders-profile">
+        <fetch entity="Customer5" association="orders" style="join"/>
+    </fetch-profile>
+</hibernate-mapping>


Property changes on: core/trunk/annotations/src/test/resources/org/hibernate/test/annotations/fetchprofile/mappings.hbm.xml
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: core/trunk/entitymanager/pom.xml
===================================================================
--- core/trunk/entitymanager/pom.xml	2010-03-04 18:15:19 UTC (rev 18923)
+++ core/trunk/entitymanager/pom.xml	2010-03-04 21:55:10 UTC (rev 18924)
@@ -65,7 +65,7 @@
         <dependency>
             <groupId>org.jboss.shrinkwrap</groupId>
             <artifactId>shrinkwrap-impl-base</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
+            <version>1.0.0-alpha-6</version>
             <scope>test</scope>
         </dependency>
         <dependency>


Property changes on: core/trunk/entitymanager/pom.xml
___________________________________________________________________
Name: svn:keywords
   + Id



More information about the hibernate-commits mailing list