HHH-4725 implement orphanRemoval for OneToOne.

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18581 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Scott Marlow 2010-01-19 15:43:00 +00:00
parent e474a00c4a
commit 63d5a97854
1 changed files with 5 additions and 1 deletions

View File

@ -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() );
}