Hi, I need the EJB QL equivilant of the following SQL [brief descr of the prob - I have 5 tables camp,a,b,c and d. a,b,c, and d are each related to camp via a campid. Each of a,b,c and d also have their own id's a_id,b_id,c_id and d_id respectively. Given these id's (i.e. a_id,b_id...), I'd like to select the matching instances of the camp table (since a,b,c and d are all related to camp via camp_id) ]:
SELECT camp.* FROM camp,a,b,c,d WHERE a.campid=camp.campid AND WHERE b.campid=camp.campid AND WHERE c.campid=camp.campid AND WHERE d.campid=camp.campid AND WHERE a.a_id="name" AND WHERE b.b_id="tel" AND WHERE c.c_id="greeting" AND WHERE d.d_id="514" 1) would the EJB QL equivilant be : SELECT DISTINCT OBJECT(camp) FROM Campaign camp, IN (camp.a) AS ca,IN (camp.b) AS cb, IN (camp.c) AS cc, IN (camp.d) AS cd WHERE ca.a_id=?1 AND WHERE cb.b_id=?2 AND WHERE cc.c_id=?3 AND WHERE cd.d_id=?4 2) Or would the EJB QL equivilant be: SELECT DISTINCT OBJECT(camp) FROM Campaign camp, RestrictionA a,RestrictionB b,RestrictionC c,RestrictionD d WHERE a.campid=camp.campid AND WHERE b.campid=camp.campid AND WHERE c.campid=camp.campid AND WHERE d.campid=camp.campid AND WHERE a.a_id=?1 AND WHERE b.b_id=?2 AND WHERE c.c_id=?3 AND WHERE d.d_id=?4 3) Or would the EJB QL equivilant be: SELECT DISTINCT OBJECT(camp) FROM Campaign camp WHERE camp.a.a_id=?1 AND WHERE camp.b.b_id=?1 AND WHERE camp.c.c_id=?1 AND WHERE camp.d.d_id=?1 Psudo code for campBean class finder method: campBean { Collection findByConstraints(String a_id,String b_id,String c_id,String d_id) } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]