I've scoured all the documentaion on EJB QL over the last few days and the only mention I've seen was part of the old EJB spec that says:
"CMP does not support inheritance"
But since EJB3.0 addresses this issue, I've moved to developing with it. And I am pleased.
Here is my problem. I have the following objects:
This code may contain errors because its from the top of my head. The code is not with me here.
//pseudo code real code is not in front of me @Entity @Inheritance(strategy=StrategyType.JOINED) @DiscriminatorColumn(name="OBJ_TYPE") class MyObject { private String name; private int id; //getters setters and ORM annotations } @Entity @Inheritance (strategy=StrategyType.JOINED) @InheritanceDiscriminator (value="S" ) @JoinColumn(column=@Column(name="OBJ_ID")) class Site extends MyObject { private String path; //getters setters and ORM annotaionts }
//this works no problem. em.createQuery("from Site s").getResultList();
//problem code. This gives me an error about entity not defined. em.createQuery("from Site s where s.name = :name"); em.setParameter("name", sName); return em.getResultList();
this is supposed to work