[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Inheritance in EJB 3 entities

apinto do-not-reply at jboss.com
Tue Jan 29 13:48:52 EST 2008

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,


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

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

More information about the jboss-user mailing list