Assume the following environment: I have a base abstract class setup for inheritence that has a Many-to-Many relationship with another class like:
| @Entity | @Inheritance(strategy = InheritanceType.JOINED) | public abstract class Automobile implements Serializable | { | private Set<Part> parts; | | @ManyToMany(mappedBy="parts") | public Set<Part> getParts() | { | return parts; | } | } | | @Entity | public class Part implements Serializable | { | private Set<Automobile> autos; | | @ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER) | public Set<Automobile> getAutomobiles() | { | return autos; | } | } | | | I have two classes that derive from my base calss. | @Entity | public class Car extends Automobile | | @Entity | public class Truck extends Automobile | Can a EJB QL query be constructed such that I only get results for one of the derived classes? Something like: for this part get only the "Cars" associated with it. SELECT auto FROM Autobile auto, IN(auto.parts) AS part where part=:specificPart and "Automobile instanceof Car" View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3998321#3998321 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3998321 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user