[jboss-user] [EJB 3.0] - LEFT JOIN Help!

justinmiller do-not-reply at jboss.com
Tue Feb 27 12:28:24 EST 2007


In EJB QL, is it possible to do a LEFT JOIN on two entities that have no declared relationship, thus simulating the ON clause in the sql equivalent??

>From the EJB 3.0 book, they give the example of finding all customers and their phone numbers - whether or not they have them:

SELECT c.firstName, c.lastName, p.number FROM Customer c LEFT JOIN c.phoneNumbers p

That works because there is a declared relationship between Customer and Phone. What if I didn't have that relationship and wanted to do something more like this:

SELECT c.firstName, c.lastName, p.number FROM Customer c LEFT JOIN Phone p WHERE c.someId=p.someId

Is that even possible?

    Thanks in advance!

    Justin

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

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



More information about the jboss-user mailing list