Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Outer Join with 3 tables is not working(Outer join with 3 tables is issuing a lot of selects for each relation on each row.)
Outer Join with 3 tables is not working [message #844402] Sat, 14 April 2012 00:53 Go to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 3
Registered: June 2010
Junior Member
Table A has One to One relation with Table B on non primary key of Table A
Table A has One to One relation with Table C on primary key of Table C

While I retrieve rows of Table A with simple JPQL query, I am getting outer join effect but, Eclipse link is issuing One select for rows of Table A and One select to fetch related objects of Table B and Table C. So if Table A has 25 rows, I am seeing 51 selects in all.

How can I tell Eclipselink to issue one select with 2 outer joins.

Thanks
Suri
Re: Outer Join with 3 tables is not working [message #846672 is a reply to message #844402] Mon, 16 April 2012 15:29 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can use "left join fetch" in your query.
Or use batch fetching through hints.

See,
http://java-persistence-performance.blogspot.com/2010/08/batch-fetching-optimizing-object-graph.html


James : Wiki : Book : Blog : Twitter
Re: Outer Join with 3 tables is not working [message #850787 is a reply to message #846672] Fri, 20 April 2012 10:28 Go to previous message
Missing name Missing name is currently offline Missing name Missing name
Messages: 3
Registered: June 2010
Junior Member
Thank you James, that was a very good article of yours.
Previous Topic:Missing descriptors
Next Topic:PK Violation on Many-to-One Child Record
Goto Forum:
  


Current Time: Tue Sep 23 06:40:17 GMT 2014

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

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