HHH-7919 : Miscellaneous embeddable bugfixes

This commit is contained in:
Gail Badner 2013-01-11 11:03:02 -08:00
parent 413ca60475
commit 29916adccb
6 changed files with 23 additions and 6 deletions

View File

@ -1658,7 +1658,14 @@ public class Binder {
*/ */
for ( AttributeBinding ab : compositeAttributeBindingContainer.attributeBindings() ) { for ( AttributeBinding ab : compositeAttributeBindingContainer.attributeBindings() ) {
if ( ab.isCascadeable() ) { if ( ab.isCascadeable() ) {
CascadeStyle cascadeStyle = Cascadeable.class.cast( ab ).getCascadeStyle(); final Cascadeable cascadeable;
if ( ab.getAttribute().isSingular() ) {
cascadeable = Cascadeable.class.cast( ab );
}
else {
cascadeable = Cascadeable.class.cast( ( (PluralAttributeBinding) ab ).getPluralAttributeElementBinding() );
}
CascadeStyle cascadeStyle = cascadeable.getCascadeStyle();
if ( cascadeStyle != CascadeStyles.NONE ) { if ( cascadeStyle != CascadeStyles.NONE ) {
elementBinding.setCascadeStyle( CascadeStyles.ALL ); elementBinding.setCascadeStyle( CascadeStyles.ALL );
} }

View File

@ -146,7 +146,7 @@ public class CompositePluralAttributeElementSourceImpl implements CompositePlura
embeddable, embeddable,
getPath(), getPath(),
createAggregatedOverrideMap( embeddableClass, entityClass.getAttributeOverrideMap() ), createAggregatedOverrideMap( embeddableClass, entityClass.getAttributeOverrideMap() ),
embeddable.getClassAccessType() embeddableClass.getClassAccessType()
) )
); );
} }

View File

@ -236,7 +236,14 @@ public class CompositeAttributeBinding
public CascadeStyle getCascadeStyle() { public CascadeStyle getCascadeStyle() {
for ( AttributeBinding attributeBinding : attributeBindings() ) { for ( AttributeBinding attributeBinding : attributeBindings() ) {
if ( attributeBinding.isCascadeable() ) { if ( attributeBinding.isCascadeable() ) {
CascadeStyle cascadeStyle = Cascadeable.class.cast( attributeBinding ).getCascadeStyle(); final Cascadeable cascadeable;
if ( attributeBinding.getAttribute().isSingular() ) {
cascadeable = Cascadeable.class.cast( attributeBinding );
}
else {
cascadeable = Cascadeable.class.cast( ( (PluralAttributeBinding) attributeBinding ).getPluralAttributeElementBinding() );
}
CascadeStyle cascadeStyle = cascadeable.getCascadeStyle();
if ( cascadeStyle != CascadeStyles.NONE ) { if ( cascadeStyle != CascadeStyles.NONE ) {
return CascadeStyles.ALL; return CascadeStyles.ALL;
} }

View File

@ -46,7 +46,6 @@ import static org.junit.Assert.assertTrue;
/** /**
* @author Emmanuel Bernard * @author Emmanuel Bernard
*/ */
@FailureExpectedWithNewMetamodel
public class EmbeddedTest extends BaseCoreFunctionalTestCase { public class EmbeddedTest extends BaseCoreFunctionalTestCase {
@Test @Test
public void testSimple() throws Exception { public void testSimple() throws Exception {
@ -154,6 +153,7 @@ public class EmbeddedTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@FailureExpectedWithNewMetamodel
public void testEmbeddedSuperclass() { public void testEmbeddedSuperclass() {
Session s; Session s;
Transaction tx; Transaction tx;
@ -191,6 +191,7 @@ public class EmbeddedTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@FailureExpectedWithNewMetamodel
public void testDottedProperty() { public void testDottedProperty() {
Session s; Session s;
Transaction tx; Transaction tx;
@ -406,6 +407,7 @@ public class EmbeddedTest extends BaseCoreFunctionalTestCase {
} }
@Test @Test
@FailureExpectedWithNewMetamodel
public void testDefaultCollectionTable() throws Exception { public void testDefaultCollectionTable() throws Exception {
//are the tables correct? //are the tables correct?
assertTrue( SchemaUtil.isTablePresent("WealthyPerson_vacationHomes", metadata() ) ); assertTrue( SchemaUtil.isTablePresent("WealthyPerson_vacationHomes", metadata() ) );
@ -457,6 +459,7 @@ public class EmbeddedTest extends BaseCoreFunctionalTestCase {
// make sure we support collection of embeddable objects inside embeddable objects // make sure we support collection of embeddable objects inside embeddable objects
@Test @Test
@FailureExpectedWithNewMetamodel
public void testEmbeddableInsideEmbeddable() throws Exception { public void testEmbeddableInsideEmbeddable() throws Exception {
Session s; Session s;
Transaction tx; Transaction tx;

View File

@ -1,6 +1,7 @@
//$Id$ //$Id$
package org.hibernate.test.annotations.embedded; package org.hibernate.test.annotations.embedded;
import java.io.Serializable; import java.io.Serializable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
@ -15,7 +16,7 @@ public class RegionalArticle implements Serializable {
private RegionalArticlePk pk; private RegionalArticlePk pk;
private String name; private String name;
@Id @EmbeddedId
public RegionalArticlePk getPk() { public RegionalArticlePk getPk() {
return pk; return pk;
} }

View File

@ -34,7 +34,6 @@ import org.junit.Test;
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@FailureExpectedWithNewMetamodel
public class ComponentJoinsTest extends BaseCoreFunctionalTestCase { public class ComponentJoinsTest extends BaseCoreFunctionalTestCase {
@Override @Override
public Class[] getAnnotatedClasses() { public Class[] getAnnotatedClasses() {