HHH-7736 join subclass support

This commit is contained in:
Strong Liu 2013-01-16 20:16:48 +08:00
parent 4187717c56
commit c4f20791a6
3 changed files with 26 additions and 17 deletions

View File

@ -449,11 +449,17 @@ public class RootEntitySourceImpl extends AbstractEntitySourceImpl implements Ro
@Override
protected List<AttributeSource> buildAttributeSources() {
List<AttributeSource> attributeSources = new ArrayList<AttributeSource>();
for ( JaxbKeyPropertyElement keyProperty : compositeIdElement().getKeyProperty()){
attributeSources.add( new IdentifierKeyAttributeSourceImpl( sourceMappingDocument(), keyProperty ) );
}
for (JaxbKeyManyToOneElement keyManyToOne : compositeIdElement().getKeyManyToOne()){
attributeSources.add( new IdentifierKeyManyToOneSourceImpl( sourceMappingDocument(), keyManyToOne ) );
final JaxbCompositeIdElement compositeId = entityElement().getCompositeId();
final List list = compositeId.getKeyPropertyOrKeyManyToOne();
for ( final Object obj : list ) {
if ( JaxbKeyPropertyElement.class.isInstance( obj ) ) {
JaxbKeyPropertyElement key = JaxbKeyPropertyElement.class.cast( obj );
attributeSources.add( new IdentifierKeyAttributeSourceImpl( sourceMappingDocument(), key ) );
}
if ( JaxbKeyManyToOneElement.class.isInstance( obj ) ) {
JaxbKeyManyToOneElement key = JaxbKeyManyToOneElement.class.cast( obj );
attributeSources.add( new IdentifierKeyManyToOneSourceImpl( sourceMappingDocument(), key ) );
}
}
return attributeSources;
}
@ -527,11 +533,16 @@ public class RootEntitySourceImpl extends AbstractEntitySourceImpl implements Ro
public List<SingularAttributeSource> getAttributeSourcesMakingUpIdentifier() {
final List<SingularAttributeSource> attributeSources = new ArrayList<SingularAttributeSource>();
final JaxbCompositeIdElement compositeId = entityElement().getCompositeId();
for ( final JaxbKeyPropertyElement keyProperty: compositeId.getKeyProperty() ) {
attributeSources.add( new IdentifierKeyAttributeSourceImpl( sourceMappingDocument(), keyProperty ) );
}
for ( final JaxbKeyManyToOneElement keyManyToOne : compositeId.getKeyManyToOne() ){
attributeSources.add( new IdentifierKeyManyToOneSourceImpl( sourceMappingDocument(), keyManyToOne ) );
final List list = compositeId.getKeyPropertyOrKeyManyToOne();
for ( final Object obj : list ) {
if ( JaxbKeyPropertyElement.class.isInstance( obj ) ) {
JaxbKeyPropertyElement key = JaxbKeyPropertyElement.class.cast( obj );
attributeSources.add( new IdentifierKeyAttributeSourceImpl( sourceMappingDocument(), key ) );
}
if ( JaxbKeyManyToOneElement.class.isInstance( obj ) ) {
JaxbKeyManyToOneElement key = JaxbKeyManyToOneElement.class.cast( obj );
attributeSources.add( new IdentifierKeyManyToOneSourceImpl( sourceMappingDocument(), key ) );
}
}
return attributeSources;

View File

@ -332,11 +332,11 @@ arbitrary number of queries, and import declarations of arbitrary classes.
<xs:sequence>
<xs:element name="meta" minOccurs="0" maxOccurs="unbounded" type="meta-element"/>
<xs:choice maxOccurs="unbounded">
<xs:annotation>
<xs:appinfo>
<simplify:as-element-property/>
</xs:appinfo>
</xs:annotation>
<!--<xs:annotation>-->
<!--<xs:appinfo>-->
<!--<simplify:as-element-property/>-->
<!--</xs:appinfo>-->
<!--</xs:annotation>-->
<xs:element name="key-property" type="key-property-element"/>
<xs:element name="key-many-to-one" type="key-many-to-one-element"/>
</xs:choice>

View File

@ -33,7 +33,6 @@ import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.criterion.Property;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.type.AbstractSingleColumnStandardBasicType;
import org.hibernate.type.TextType;
@ -76,7 +75,6 @@ public class OneToOneFormulaTest extends BaseCoreFunctionalTestCase {
}
@Test
@FailureExpectedWithNewMetamodel
public void testOneToOneFormula() {
Person p = new Person();
p.setName("Gavin King");