Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Criteria API: left outer join
Criteria API: left outer join [message #634346] Thu, 21 October 2010 07:09 Go to next message
Patrick Haun is currently offline Patrick Haun
Messages: 30
Registered: October 2009
Member
I try to convert a JPQL statement to the criteria API. The JPQL query uses a LEFT OUTER JOIN to create the result.

I tried this using the criteria api:
 final Join<Object, Object> join = root.join("applInstance", JoinType.LEFT);


Unfortunately the resulting sql code doesn't contain an left outer join.


The JPQL query:
SELECT events FROM Events events LEFT JOIN events.applInstance applInstance

[Updated on: Thu, 21 October 2010 07:27]

Report message to a moderator

Re: Criteria API: left outer join [message #634394 is a reply to message #634346] Thu, 21 October 2010 10:31 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris Delahunt
Messages: 995
Registered: July 2009
Senior Member
Hello,

Are you trying to have the events.applInstance fetched with the returned event objects? If the join is not used in the selection criteria, an outer join will do nothing other than add extra processing work to the database query. You might want to use the fetch instead.

That said, the query adds the join to the SQL for for me on the latest version of EclipseLink (2.2 nightly build). Which version are you using, and what is the SQL generated for both queries?

Best Regards,
Chris
Re: Criteria API: left outer join [message #634618 is a reply to message #634346] Fri, 22 October 2010 08:58 Go to previous message
Patrick Haun is currently offline Patrick Haun
Messages: 30
Registered: October 2009
Member
I found a solution. I didn't use the join object in the where clause.
Previous Topic:Standalone use of MOXy
Next Topic:Eclipselink query optimization problem
Goto Forum:
  


Current Time: Thu Apr 17 17:39:54 EDT 2014

Powered by FUDForum. Page generated in 0.02345 seconds