0 Replies Latest reply on Aug 23, 2006 5:42 AM by oglueck

    Bug in joined inheritance

      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.