0 Replies Latest reply on Jan 29, 2008 1:48 PM by Armenio Pinto

    Inheritance in EJB 3 entities

    Armenio Pinto Newbie

      Hi there,

      In an EJB 3 entities beans scenario, I have an abstract entity class that's extended by my beans. The problem is that, even though I specify the table names in the extending classes, in the named queries the references are always substituted by the super (abstract) class name. For example:

      (...)
      @Entity
      public class AbstractEntity
      (...)
      
      (...)
      @Table(name="MyClass")
      @NamedQueries( {
       @NamedQuery(name="MyClass.getAll", query="SELECT c FROM MyClass c")
      })
      public class MyClass extends AbstractEntity
      (...)
      


      When the named query query is executed, instead if translating the table name to "MyClass", it translates to "AbstractEntity"... What am I doing wrong?

      Thanks you a lot for the help,

      AP