Because the EJB3.0 FD spec doesn't say to much about that kind of inheritance 
strategy, I looked up at the following examples:
[i]http://docs.jboss.org/ejb3/app-server/tutorial/tableperinheritance/table.html[/i]

I played with them but an exception occured:
javax.ejb.EJBException: org.hibernate.exception.SQLGrammarException: could not 
execute query
        at 
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
        at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
        *****
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
        at 
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
        at 
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.doList(Loader.java:2148)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
        at org.hibernate.loader.Loader.list(Loader.java:2024)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
        at 
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
        at 
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1129)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:39)
        ****
Caused by: java.sql.SQLException: ORA-00942: table or view does not exist

I have the following class definition:

@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Pet implements java.io.Serializable {
    private int id;

    private String name;

    private int weight;
   *****
-----------------------------------------

@Entity
@Table(name="CAT")
public class Cat extends Pet
{
   int lives;

   public int getLives()
   {
      return lives;
   }

   public void setLives(int lives)
   {
      this.lives = lives;
   }
}
---------------------------------------------

@Entity
@Table(name="DOG")
public class Dog extends Pet
{
   private int numBones;

   public int getNumBones()
   {
      return numBones;
   }

   public void setNumBones(int numBones)
   {
      this.numBones = numBones;
   }
}

and a stateless session bean:
public List getAllPets( ){

    return em.createQuery("from Pet p").getResultList();

}

************************

I have only two table - CAT and DOG exactly as provided in the example above.

Can anyone see where is the problem - should I have table PET?!?

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to