Skip to main content



      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
Eclipse UserFriend
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] by 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
Eclipse UserFriend
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
Eclipse UserFriend
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 Jul 17 04:15:29 EDT 2025

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

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

Back to the top