[hibernate-commits] Hibernate SVN: r19500 - in core/branches/Branch_3_5/envers: src/main/java/org/hibernate/envers/configuration/metadata and 5 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu May 13 02:45:06 EDT 2010


Author: gbadner
Date: 2010-05-13 02:45:04 -0400 (Thu, 13 May 2010)
New Revision: 19500

Removed:
   core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/integration/manytomany/inverseToSuperclass/
   core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/integration/onetomany/inverseToSuperclass/
   core/branches/Branch_3_5/envers/src/test/resources/mappings/manyToMany/
   core/branches/Branch_3_5/envers/src/test/resources/mappings/oneToMany/
Modified:
   core/branches/Branch_3_5/envers/pom.xml
   core/branches/Branch_3_5/envers/src/main/java/org/hibernate/envers/configuration/metadata/BasicMetadataGenerator.java
   core/branches/Branch_3_5/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
   core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/entities/customtype/CompositeTestUserType.java
   core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/entities/customtype/ParametrizedTestUserType.java
   core/branches/Branch_3_5/envers/src/test/resources/testng.xml
Log:
revert to revision 19480 (the last Branch_3_5 revision before 19482)

Modified: core/branches/Branch_3_5/envers/pom.xml
===================================================================
--- core/branches/Branch_3_5/envers/pom.xml	2010-05-13 02:10:16 UTC (rev 19499)
+++ core/branches/Branch_3_5/envers/pom.xml	2010-05-13 06:45:04 UTC (rev 19500)
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-parent</artifactId>
-        <version>3.6.0-SNAPSHOT</version>
+        <version>3.5.2-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 

Modified: core/branches/Branch_3_5/envers/src/main/java/org/hibernate/envers/configuration/metadata/BasicMetadataGenerator.java
===================================================================
--- core/branches/Branch_3_5/envers/src/main/java/org/hibernate/envers/configuration/metadata/BasicMetadataGenerator.java	2010-05-13 02:10:16 UTC (rev 19499)
+++ core/branches/Branch_3_5/envers/src/main/java/org/hibernate/envers/configuration/metadata/BasicMetadataGenerator.java	2010-05-13 06:45:04 UTC (rev 19500)
@@ -33,9 +33,10 @@
 import org.hibernate.mapping.Column;
 import org.hibernate.mapping.SimpleValue;
 import org.hibernate.mapping.Value;
-import org.hibernate.type.BasicType;
 import org.hibernate.type.CompositeCustomType;
 import org.hibernate.type.CustomType;
+import org.hibernate.type.ImmutableType;
+import org.hibernate.type.MutableType;
 import org.hibernate.type.Type;
 
 /**
@@ -47,7 +48,7 @@
 					 Value value, SimpleMapperBuilder mapper, boolean insertable, boolean key) {
 		Type type = value.getType();
 
-		if ( type instanceof BasicType ) {
+		if (type instanceof ImmutableType || type instanceof MutableType) {
 			addSimpleValue(parent, propertyAuditingData, value, mapper, insertable, key);
 		} else if (type instanceof CustomType || type instanceof CompositeCustomType) {
 			addCustomValue(parent, propertyAuditingData, value, mapper, insertable, key);

Modified: core/branches/Branch_3_5/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java
===================================================================
--- core/branches/Branch_3_5/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java	2010-05-13 02:10:16 UTC (rev 19499)
+++ core/branches/Branch_3_5/envers/src/main/java/org/hibernate/envers/configuration/metadata/CollectionMetadataGenerator.java	2010-05-13 06:45:04 UTC (rev 19500)
@@ -80,7 +80,6 @@
 /**
  * Generates metadata for a collection-valued property.
  * @author Adam Warski (adam at warski dot org)
- * @author Hern�n Chanfreau
  */
 public final class CollectionMetadataGenerator {
     private static final Logger log = LoggerFactory.getLogger(CollectionMetadataGenerator.class);
@@ -534,6 +533,7 @@
         return middleEntityXmlId;
     }
 
+    @SuppressWarnings({"unchecked"})
     private String getMappedBy(Collection collectionValue) {
         PersistentClass referencedClass = ((OneToMany) collectionValue.getElement()).getAssociatedClass();
 
@@ -543,31 +543,8 @@
             return auditMappedBy;
         }
 
-        // searching in referenced class
-        String mappedBy = this.searchMappedBy(referencedClass, collectionValue);
-        
-        if(mappedBy == null) {
-            log.debug("Going to search the mapped by attribute for " + propertyName + " in superclasses of entity: " + referencedClass.getClassName());
-            
-            PersistentClass tempClass = referencedClass;
-			while ((mappedBy == null) && (tempClass.getSuperclass() != null)) {
-	            log.debug("Searching in superclass: " + tempClass.getSuperclass().getClassName());
-				mappedBy = this.searchMappedBy(tempClass.getSuperclass(), collectionValue);
-				tempClass = tempClass.getSuperclass();
-			}
-        }
-
-        if(mappedBy == null) { 
-	        throw new MappingException("Unable to read the mapped by attribute for " + propertyName + " in "
-	                + referencedClass.getClassName() + "!");
-        }
-        
-        return mappedBy;
-    }        
-
-    @SuppressWarnings({"unchecked"})
-    private String searchMappedBy(PersistentClass referencedClass, Collection collectionValue) {
         Iterator<Property> assocClassProps = referencedClass.getPropertyIterator();
+
         while (assocClassProps.hasNext()) {
             Property property = assocClassProps.next();
 
@@ -575,10 +552,13 @@
                     collectionValue.getKey().getColumnIterator())) {
                 return property.getName();
             }
-        }    	
-        return null;
+        }
+
+        throw new MappingException("Unable to read the mapped by attribute for " + propertyName + " in "
+                + referencingEntityName + "!");
     }
 
+    @SuppressWarnings({"unchecked"})
     private String getMappedBy(Table collectionTable, PersistentClass referencedClass) {
         // If there's an @AuditMappedBy specified, returning it directly.
         String auditMappedBy = propertyAuditingData.getAuditMappedBy();
@@ -586,31 +566,6 @@
             return auditMappedBy;
         }
 
-        // searching in referenced class
-        String mappedBy = this.searchMappedBy(referencedClass, collectionTable);
-
-        // not found on referenced class, searching on superclasses
-        if(mappedBy == null) { 
-            log.debug("Going to search the mapped by attribute for " + propertyName + " in superclases of entity: " + referencedClass.getClassName());
-
-            PersistentClass tempClass = referencedClass;
-			while ((mappedBy == null) && (tempClass.getSuperclass() != null)) {
-	            log.debug("Searching in superclass: " + tempClass.getSuperclass().getClassName());
-				mappedBy = this.searchMappedBy(tempClass.getSuperclass(), collectionTable);
-				tempClass = tempClass.getSuperclass();
-			}
-        }
-
-        if(mappedBy == null) { 
-	        throw new MappingException("Unable to read the mapped by attribute for " + propertyName + " in "
-	                + referencedClass.getClassName() + "!");
-        }
-        
-        return mappedBy;
-    }
-    
-    @SuppressWarnings({"unchecked"})
-    private String searchMappedBy(PersistentClass referencedClass, Table collectionTable) {
         Iterator<Property> properties = referencedClass.getPropertyIterator();
         while (properties.hasNext()) {
             Property property = properties.next();
@@ -621,8 +576,9 @@
                     return property.getName();
                 }
             }
-        }   
-        return null;
+        }
+
+        throw new MappingException("Unable to read the mapped by attribute for " + propertyName + " in "
+                + referencingEntityName + "!");
     }
-   
 }

Modified: core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/entities/customtype/CompositeTestUserType.java
===================================================================
--- core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/entities/customtype/CompositeTestUserType.java	2010-05-13 02:10:16 UTC (rev 19499)
+++ core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/entities/customtype/CompositeTestUserType.java	2010-05-13 06:45:04 UTC (rev 19500)
@@ -28,10 +28,9 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
+import org.hibernate.Hibernate;
 import org.hibernate.HibernateException;
 import org.hibernate.engine.SessionImplementor;
-import org.hibernate.type.IntegerType;
-import org.hibernate.type.StringType;
 import org.hibernate.type.Type;
 import org.hibernate.usertype.CompositeUserType;
 
@@ -45,7 +44,7 @@
     }
 
     public Type[] getPropertyTypes() {
-        return new Type[] { StringType.INSTANCE, IntegerType.INSTANCE };
+        return new Type[] { Hibernate.STRING, Hibernate.INTEGER };
     }
 
     public Object getPropertyValue(final Object component, final int property) throws HibernateException {
@@ -107,8 +106,8 @@
             throws HibernateException, SQLException
     {
         if (value == null) {
-            st.setNull(index, StringType.INSTANCE.sqlType());
-            st.setNull(index + 1, IntegerType.INSTANCE.sqlType());
+            st.setNull(index, Hibernate.STRING.sqlType());
+            st.setNull(index + 1, Hibernate.INTEGER.sqlType());
         } else {
             final Component comp = (Component) value;
             st.setString(index, comp.getProp1());

Modified: core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/entities/customtype/ParametrizedTestUserType.java
===================================================================
--- core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/entities/customtype/ParametrizedTestUserType.java	2010-05-13 02:10:16 UTC (rev 19499)
+++ core/branches/Branch_3_5/envers/src/test/java/org/hibernate/envers/test/entities/customtype/ParametrizedTestUserType.java	2010-05-13 06:45:04 UTC (rev 19500)
@@ -32,7 +32,6 @@
 
 import org.hibernate.Hibernate;
 import org.hibernate.HibernateException;
-import org.hibernate.type.StringType;
 import org.hibernate.usertype.ParameterizedType;
 import org.hibernate.usertype.UserType;
 
@@ -55,7 +54,7 @@
     }
 
     public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException {
-        return StringType.INSTANCE.nullSafeGet( rs, names[0] );
+        return Hibernate.STRING.nullSafeGet(rs, names[0]);
     }
 
     public void nullSafeSet(PreparedStatement st, Object value, int index) throws HibernateException, SQLException {
@@ -67,11 +66,10 @@
             if (!v.endsWith(param2)) {
                 v = v + param2;
             }
-            StringType.INSTANCE.nullSafeSet(st, v, index);
+            Hibernate.STRING.nullSafeSet(st, v, index);
+        } else {
+            Hibernate.STRING.nullSafeSet(st, value, index);
         }
-		else {
-            StringType.INSTANCE.nullSafeSet( st, null, index );
-        }
     }
 
     public int[] sqlTypes() {

Modified: core/branches/Branch_3_5/envers/src/test/resources/testng.xml
===================================================================
--- core/branches/Branch_3_5/envers/src/test/resources/testng.xml	2010-05-13 02:10:16 UTC (rev 19499)
+++ core/branches/Branch_3_5/envers/src/test/resources/testng.xml	2010-05-13 06:45:04 UTC (rev 19500)
@@ -43,7 +43,6 @@
             <package name="org.hibernate.envers.test.integration.interfaces.hbm.propertiesAudited2.union" />
             <package name="org.hibernate.envers.test.integration.manytomany" />
             <package name="org.hibernate.envers.test.integration.manytomany.biowned" />
-            <package name="org.hibernate.envers.test.integration.manytomany.inverseToSuperclass" />
             <package name="org.hibernate.envers.test.integration.manytomany.sametable" />
             <package name="org.hibernate.envers.test.integration.manytomany.ternary" />
             <package name="org.hibernate.envers.test.integration.manytomany.unidirectional" />
@@ -54,7 +53,6 @@
             <package name="org.hibernate.envers.test.integration.notinsertable.manytoone" />
             <package name="org.hibernate.envers.test.integration.onetomany" />
             <package name="org.hibernate.envers.test.integration.onetomany.detached" />
-            <package name="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass" />
             <package name="org.hibernate.envers.test.integration.onetoone.bidirectional" />
             <package name="org.hibernate.envers.test.integration.onetoone.bidirectional.ids" />
             <package name="org.hibernate.envers.test.integration.onetoone.unidirectional" />



More information about the hibernate-commits mailing list