[jboss-user] [EJB 3.0] - Bug in joined inheritance

oglueck do-not-reply at jboss.com
Wed Aug 23 05:42:26 EDT 2006


Version: JBoss EJB-3RC8 

I have a simple class hierarchy that uses joined inheritance:

  | @Entity
  | @Inheritance(strategy=InheritanceType.JOINED)
  | public class MaterialMaster {
  |   private String externalId;
  | }
  | 
  | @Entity
  | @PrimaryKeyJoinColumn(name="ID")
  | public class SparePartMaster extends MaterialMaster {
  | 
  | }
  | 

This hierarchy is referenced by another class:

  | @Entity
  | public class RecallOrderLine  {
  |   @ManyToOne(fetch=FetchType.LAZY, optional=false)
  |   private RecallOrder recallOrder;
  | 
  |   @OneToOne(fetch=FetchType.LAZY, optional=false)
  |   private MaterialMaster material;
  | }
  | 

When I query

  | SELECT r FROM RecallOrderLine r 
  | WHERE r.recallOrder=:recallOrder 
  |     AND r.material =:material
  | 
the returned RecallOrderLine has a SparePartMaster instance as expected.

Now when I query

  | SELECT r FROM RecallOrderLine r 
  | WHERE r.recallOrder=:recallOrder 
  |     AND r.material.externalId =:matExtKey
  | 
the returned RecallOrderLine has a MaterialMaster instance only!

My DB is correct. So it must be a bug in Hibernate.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966913#3966913

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966913



More information about the jboss-user mailing list