[hibernate-commits] Hibernate SVN: r18581 - core/trunk/annotations/src/main/java/org/hibernate/cfg.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Jan 19 10:43:01 EST 2010


Author: smarlow at redhat.com
Date: 2010-01-19 10:43:00 -0500 (Tue, 19 Jan 2010)
New Revision: 18581

Modified:
   core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
Log:
HHH-4725  implement orphanRemoval for OneToOne.

Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java	2010-01-19 14:34:11 UTC (rev 18580)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java	2010-01-19 15:43:00 UTC (rev 18581)
@@ -1455,7 +1455,7 @@
 				}
 			}
 			bindOneToOne(
-					getCascadeStrategy( ann.cascade(), hibernateCascade, false),
+					getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval()),
 					joinColumns,
 					ann.optional(),
 					getFetchMode( ann.fetch() ),
@@ -2147,6 +2147,10 @@
 	) {
 		//All FK columns should be in the same table
 		org.hibernate.mapping.ManyToOne value = new org.hibernate.mapping.ManyToOne( columns[0].getTable() );
+		// This is a @OneToOne mapped to a physical o.h.mapping.ManyToOne
+		if ( unique ) {
+			value.markAsLogicalOneToOne();
+		}
 		if ( isDefault( targetEntity, mappings ) ) {
 			value.setReferencedEntityName( inferredData.getClassOrElementName() );
 		}



More information about the hibernate-commits mailing list