From 63d5a97854246083bcd28c00da45a9b363d276cd Mon Sep 17 00:00:00 2001 From: Scott Marlow Date: Tue, 19 Jan 2010 15:43:00 +0000 Subject: [PATCH] HHH-4725 implement orphanRemoval for OneToOne. git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18581 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../src/main/java/org/hibernate/cfg/AnnotationBinder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java b/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java index 6fb1b2d9eb..f8a19defee 100644 --- a/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java +++ b/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java @@ -1455,7 +1455,7 @@ public final class AnnotationBinder { } } bindOneToOne( - getCascadeStrategy( ann.cascade(), hibernateCascade, false), + getCascadeStrategy( ann.cascade(), hibernateCascade, ann.orphanRemoval()), joinColumns, ann.optional(), getFetchMode( ann.fetch() ), @@ -2147,6 +2147,10 @@ public final class AnnotationBinder { ) { //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() ); }