I am not sure how to do something and have tried a couple of approaches without
success. I could use some help.
My problem comes down to the idea that I want to return a mapped object but based on a
complex query that gets messed up due to the way OJB uses foreign keys. Is there a
way to do a query on tables not referenced in the object you seek to return? I want
to return rstep1 objects (A0), but I need to create a complex query in other tables to
get rstep1 objects.
What I would to have happened is something like:
SELECT A0.rTitle, A0.brief
FROM rstep1 A0, si A1
WHERE ((A1.targetmsid = 20001025 )
AND A1.targetmid = 200000001 )
AND interestmsid = A0.msid
What I do get through OJB's use of the foreign key is:
SELECT A0.rTitle, A0.brief
FROM rstep1 A0
INNER JOIN si A1 ON A0.msid=A1.targetmsid
WHERE ((A1.targetmsid = 20001025 )
AND A1.targetmid = 200000001 )
AND A1.interestmsid = A0.msid
Is there a way to create a query that returns a mapped object where tables referened
are not held within the object? I only want to return values rstep1, but have to
reference another table only within the query. The query gets messed up because of
the foreign key used to generate the query.
I have tried below without using a reference to the si table, but si becomes ambigous.
crit.addSql("si.targetmsid = " + jMsid);
crit.addSql("si.targetmid = " + jMid);
crit.addSql("si.interestmsid = rstep1.msid");
I have tried below with references to the si table and it creates the 2nd query above
with the incorrect INNER JOIN.
crit.addEqualTo("si.targetmsid", jMsid);
crit.addEqualTo("si.targetmid", jMid);
crit.addEqualToField("si.interestmsid", "memberServiceId");
In this second case, if a reference is required, is there a way that I can not
have an INNER JOIN on the foreign key be created.
Thank you for any help.
JohnE
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]