From: <hib...@li...> - 2006-04-28 15:32:16
|
Author: epbernard Date: 2006-04-28 11:32:01 -0400 (Fri, 28 Apr 2006) New Revision: 9831 Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ArrayBinder.java trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ListBinder.java trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java Log: ANN-224 @Fetch(FetchMode) @LazyToOne(LazyToOneOption) @LazyCollection(LazyCollectionOption) Clean up the old fetching mechanism Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-04-28 15:16:41 UTC (rev 9830) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-04-28 15:32:01 UTC (rev 9831) @@ -1335,7 +1335,6 @@ collectionBinder.setTargetEntity( mappings.getReflectionManager().toXClass( oneToManyAnn.targetEntity() ) ); - collectionBinder.setFetchType( oneToManyAnn.fetch() ); collectionBinder.setCascadeStrategy( getCascadeStrategy( oneToManyAnn.cascade(), hibernateCascade ) ); collectionBinder.setOneToMany( true ); } @@ -1350,7 +1349,6 @@ collectionBinder.setTargetEntity( mappings.getReflectionManager().toXClass( collectionOfElementsAnn.targetElement() ) ); - collectionBinder.setFetchType( collectionOfElementsAnn.fetch() ); //collectionBinder.setCascadeStrategy( getCascadeStrategy( embeddedCollectionAnn.cascade(), hibernateCascade ) ); collectionBinder.setOneToMany( true ); } @@ -1359,7 +1357,6 @@ collectionBinder.setTargetEntity( mappings.getReflectionManager().toXClass( manyToManyAnn.targetEntity() ) ); - collectionBinder.setFetchType( manyToManyAnn.fetch() ); collectionBinder.setCascadeStrategy( getCascadeStrategy( manyToManyAnn.cascade(), hibernateCascade ) ); collectionBinder.setOneToMany( false ); } Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ArrayBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ArrayBinder.java 2006-04-28 15:16:41 UTC (rev 9830) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ArrayBinder.java 2006-04-28 15:32:01 UTC (rev 9831) @@ -1,8 +1,5 @@ package org.hibernate.cfg.annotations; -import javax.persistence.FetchType; - -import org.hibernate.FetchMode; import org.hibernate.mapping.Array; import org.hibernate.mapping.Collection; import org.hibernate.mapping.PersistentClass; @@ -17,11 +14,6 @@ public ArrayBinder() { } - public void setFetchType(FetchType fetch) { - //workaround to hibernate3 bug, remove it once fixed - fetchMode = FetchMode.SELECT; - } - protected Collection createCollection(PersistentClass persistentClass) { return new Array( persistentClass ); } Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java 2006-04-28 15:16:41 UTC (rev 9830) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/CollectionBinder.java 2006-04-28 15:32:01 UTC (rev 9831) @@ -75,7 +75,6 @@ protected Collection collection; protected String propertyName; - FetchMode fetchMode; PropertyHolder propertyHolder; int batchSize; String where; @@ -343,7 +342,6 @@ elementColumns, mapKeyColumns, isEmbedded, property, collType, - fetchMode, ignoreNotFound, oneToMany, tableBinder, mappings ); @@ -448,7 +446,7 @@ final Ejb3Column[] elementColumns, final Ejb3Column[] mapKeyColumns, final boolean isEmbedded, final XProperty property, final String collType, - final FetchMode fetchMode, final boolean ignoreNotFound, final boolean unique, + final boolean ignoreNotFound, final boolean unique, final TableBinder assocTableBinder, final ExtendedMappings mappings ) { @@ -458,7 +456,7 @@ throws MappingException { bindStarToManySecondPass( persistentClasses, collType, fkJoinColumns, keyColumns, inverseColumns, elementColumns, - isEmbedded, property, fetchMode, unique, assocTableBinder, ignoreNotFound, mappings + isEmbedded, property, unique, assocTableBinder, ignoreNotFound, mappings ); } @@ -472,7 +470,7 @@ Map persistentClasses, String collType, Ejb3JoinColumn[] fkJoinColumns, Ejb3JoinColumn[] keyColumns, Ejb3JoinColumn[] inverseColumns, Ejb3Column[] elementColumns, boolean isEmbedded, - XProperty property, FetchMode fetchMode, boolean unique, + XProperty property, boolean unique, TableBinder associationTableBinder, boolean ignoreNotFound, ExtendedMappings mappings ) { boolean isEntity = persistentClasses.containsKey( collType ); @@ -502,7 +500,6 @@ inverseColumns, elementColumns, isEmbedded, collType, - fetchMode, ignoreNotFound, unique, cascadeDeleteEnabled, associationTableBinder, property, mappings @@ -579,15 +576,6 @@ } } - public void setFetchType(FetchType fetch) { - if ( fetch == FetchType.EAGER ) { - fetchMode = FetchMode.JOIN; - } - else { - fetchMode = FetchMode.SELECT; - } - } - public void addFilter(String name, String condition) { filters.put( name, condition ); } @@ -747,7 +735,6 @@ Ejb3Column[] elementColumns, boolean isEmbedded, String collType, - FetchMode fetchMode, boolean ignoreNotFound, boolean unique, boolean cascadeDeleteEnabled, TableBinder associationTableBinder, XProperty property, ExtendedMappings mappings Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ListBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ListBinder.java 2006-04-28 15:16:41 UTC (rev 9830) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/ListBinder.java 2006-04-28 15:32:01 UTC (rev 9831) @@ -5,7 +5,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hibernate.AnnotationException; -import org.hibernate.FetchMode; import org.hibernate.MappingException; import org.hibernate.annotations.OrderBy; import org.hibernate.annotations.Sort; @@ -56,7 +55,7 @@ final Ejb3Column[] elementColumns, Ejb3Column[] mapKeyColumns, final boolean isEmbedded, final XProperty property, final String collType, - final FetchMode fetchMode, final boolean ignoreNotFound, final boolean unique, + final boolean ignoreNotFound, final boolean unique, final TableBinder assocTableBinder, final ExtendedMappings mappings ) { return new CollectionSecondPass( mappings, ListBinder.this.collection ) { @@ -64,7 +63,7 @@ throws MappingException { bindStarToManySecondPass( persistentClasses, collType, fkJoinColumns, keyColumns, inverseColumns, elementColumns, - isEmbedded, property, fetchMode, unique, assocTableBinder, ignoreNotFound, mappings + isEmbedded, property, unique, assocTableBinder, ignoreNotFound, mappings ); bindIndex( mappings ); } Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java 2006-04-28 15:16:41 UTC (rev 9830) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java 2006-04-28 15:32:01 UTC (rev 9831) @@ -57,7 +57,7 @@ final Ejb3Column[] elementColumns, final Ejb3Column[] mapKeyColumns, final boolean isEmbedded, final XProperty property, final String collType, - final FetchMode fetchMode, final boolean ignoreNotFound, final boolean unique, + final boolean ignoreNotFound, final boolean unique, final TableBinder assocTableBinder, final ExtendedMappings mappings ) { return new CollectionSecondPass( mappings, MapBinder.this.collection ) { @@ -65,7 +65,7 @@ throws MappingException { bindStarToManySecondPass( persistentClasses, collType, fkJoinColumns, keyColumns, inverseColumns, elementColumns, - isEmbedded, property, fetchMode, unique, assocTableBinder, ignoreNotFound, mappings + isEmbedded, property, unique, assocTableBinder, ignoreNotFound, mappings ); bindKeyFromAssociationTable( collType, persistentClasses, mapKeyPropertyName, property, ignoreNotFound, isEmbedded, mappings, |