Skip to content

Commit

Permalink
HHH-7736 join subclass support
Browse files Browse the repository at this point in the history
  • Loading branch information
stliu committed Jan 16, 2013
1 parent 4187717 commit c4f2079
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,17 @@ protected JaxbCompositeIdElement compositeIdElement() {
@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;
}
Expand Down Expand Up @@ -527,11 +533,16 @@ public String getIdClassPropertyAccessorName() {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
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;
Expand Down Expand Up @@ -76,7 +75,6 @@ public void configure(Configuration cfg) {
}

@Test
@FailureExpectedWithNewMetamodel
public void testOneToOneFormula() {
Person p = new Person();
p.setName("Gavin King");
Expand Down

0 comments on commit c4f2079

Please sign in to comment.