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() ) {
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 ) {
elementBinding.setCascadeStyle( CascadeStyles.ALL );
}

View File

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

View File

@ -236,7 +236,14 @@ public class CompositeAttributeBinding
public CascadeStyle getCascadeStyle() {
for ( AttributeBinding attributeBinding : attributeBindings() ) {
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 ) {
return CascadeStyles.ALL;
}

View File

@ -46,7 +46,6 @@ import static org.junit.Assert.assertTrue;
/**
* @author Emmanuel Bernard
*/
@FailureExpectedWithNewMetamodel
public class EmbeddedTest extends BaseCoreFunctionalTestCase {
@Test
public void testSimple() throws Exception {
@ -154,6 +153,7 @@ public class EmbeddedTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
public void testEmbeddedSuperclass() {
Session s;
Transaction tx;
@ -191,6 +191,7 @@ public class EmbeddedTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
public void testDottedProperty() {
Session s;
Transaction tx;
@ -406,6 +407,7 @@ public class EmbeddedTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
public void testDefaultCollectionTable() throws Exception {
//are the tables correct?
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
@Test
@FailureExpectedWithNewMetamodel
public void testEmbeddableInsideEmbeddable() throws Exception {
Session s;
Transaction tx;

View File

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

View File

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