JBoss 4.0.4 GA Patch 1, ejb3-clustered from .jar installer
I have a hierarchy of entities using JOINED inheritance, the hierarchy is:
Structure
-> House
-> Apartment
(Structure is the root of the hierarchy flagged with @Inheritance attribute,
the others extend Structure and provide @DiscriminatorValue's )
I have @OneToMany lazy loading from another bean to get all of the "Structure"s
that are associated with it, and the method returns all of the Structure's
(House and/or Apartments), but the returned objects cannot be cast to their
appropriate type. IE:
List< Structure > structures = myBlock.getStructures();
for( Structure structure : structures )
{
if ( structure instanceof House ) { ... } // this is always false
if ( structure instanceof Apartment ) { ... } // this is always false
}
and deliberately casting to a sub-type via:
((House)structure).doSomething() throws a class cast exception, even though
the entity in question is discriminated as a House.
I've tried both javassist and cglib byte enhancers, both produce the
ClassCastException
So is this a bug?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964512#3964512
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964512
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user