[hibernate-commits] Hibernate SVN: r14759 - in annotations/trunk/src: java/org/hibernate/cfg/annotations/reflection and 2 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Jun 10 10:14:15 EDT 2008


Author: hardy.ferentschik
Date: 2008-06-10 10:14:15 -0400 (Tue, 10 Jun 2008)
New Revision: 14759

Modified:
   annotations/trunk/src/java/org/hibernate/cfg/OneToOneSecondPass.java
   annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/EJB3OverridenAnnotationReader.java
   annotations/trunk/src/test/log4j.properties
   annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/Address.java
Log:
ANN-742:
* Fixed bug in OneToOneSecondPass where the mapped by side of the one to one association also attempted to create the PK and FK
* little code cleanup

Modified: annotations/trunk/src/java/org/hibernate/cfg/OneToOneSecondPass.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/OneToOneSecondPass.java	2008-06-10 13:48:38 UTC (rev 14758)
+++ annotations/trunk/src/java/org/hibernate/cfg/OneToOneSecondPass.java	2008-06-10 14:14:15 UTC (rev 14759)
@@ -215,7 +215,16 @@
 		if ( !BinderHelper.isDefault( fkName ) ) value.setForeignKeyName( fkName );
 	}
 
-	//dirty dupe of EntityBinder.bindSecondaryTable
+	/**
+	 * Builds the <code>Join</code> instance for the mapped by side of a <i>OneToOne</i> association using 
+	 * a join tables.
+	 * <p>
+	 * Note:<br/>
+	 * <ul>
+	 * <li>From the mappedBy side we should not create the PK nor the FK, this is handled from the other side.</li>
+	 * <li>This method is a dirty dupe of EntityBinder.bindSecondaryTable</i>.
+	 * </p>
+	 */
 	private Join buildJoinFromMappedBySide(PersistentClass persistentClass, Property otherSideProperty, Join originalJoin) {
 		Join join = new Join();
 		join.setPersistentClass( persistentClass );
@@ -247,9 +256,6 @@
 			copy.setDefaultValue( column.getDefaultValue() );
 			key.addColumn( copy );
 		}
-		//from the mappedBy side we should not create the PK nor the FK, this is handled from te other side
-		//join.createPrimaryKey();
-		//join.createForeignKey();
 		persistentClass.addJoin( join );
 		return join;
 	}

Modified: annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/EJB3OverridenAnnotationReader.java
===================================================================
--- annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/EJB3OverridenAnnotationReader.java	2008-06-10 13:48:38 UTC (rev 14758)
+++ annotations/trunk/src/java/org/hibernate/cfg/annotations/reflection/EJB3OverridenAnnotationReader.java	2008-06-10 14:14:15 UTC (rev 14759)
@@ -103,6 +103,7 @@
  * @author Davide Marchignoli
  * @author Emmanuel Bernard
  */
+ at SuppressWarnings("unchecked")
 public class EJB3OverridenAnnotationReader implements AnnotationReader {
 	private Logger log = LoggerFactory.getLogger( EJB3OverridenAnnotationReader.class );
 	private static final Map<Class, String> annotationToXml;

Modified: annotations/trunk/src/test/log4j.properties
===================================================================
--- annotations/trunk/src/test/log4j.properties	2008-06-10 13:48:38 UTC (rev 14758)
+++ annotations/trunk/src/test/log4j.properties	2008-06-10 14:14:15 UTC (rev 14759)
@@ -21,7 +21,7 @@
 
 log4j.rootLogger=warn, stdout
 
-log4j.logger.org.hibernate=info
+log4j.logger.org.hibernate=debug
 
 
 ### log just the SQL
@@ -30,13 +30,13 @@
 #log4j.logger.org.hibernate.engine.CascadingAction=debug
 
 ### log JDBC bind parameters ###
-#log4j.logger.org.hibernate.type=debug
+log4j.logger.org.hibernate.type=debug
 
 ### log schema export/update ###
 log4j.logger.org.hibernate.tool.hbm2ddl=debug
 
 ### log cache activity ###
-#log4j.logger.org.hibernate.cache=debug
+log4j.logger.org.hibernate.cache=debug
 
 ### enable the following line if you want to track down connection ###
 ### leakages when using DriverManagerConnectionProvider ###

Modified: annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/Address.java
===================================================================
--- annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/Address.java	2008-06-10 13:48:38 UTC (rev 14758)
+++ annotations/trunk/src/test/org/hibernate/test/annotations/onetoone/primarykey/Address.java	2008-06-10 14:14:15 UTC (rev 14759)
@@ -3,10 +3,7 @@
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
 import javax.persistence.OneToOne;
-import javax.persistence.Transient;
 
 @Entity
 public class Address {
@@ -15,7 +12,6 @@
 	private long id;
 
 	@OneToOne(mappedBy = "address")
-
 	private Person person;
 
 	public long getId() {




More information about the hibernate-commits mailing list