Skip to main content


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 11:09 Go to next message
Patrick Haun is currently offline Patrick HaunFriend
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 11:27]

Report message to a moderator

Re: Criteria API: left outer join [message #634394 is a reply to message #634346] Thu, 21 October 2010 14:31 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
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 12:58 Go to previous message
Patrick Haun is currently offline Patrick HaunFriend
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 18 13:32:21 GMT 2024

Powered by FUDForum. Page generated in 0.01742 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top