Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Join Table with additional columns: One SQL Select to fetch data?

You can use join fetching or batch reading for this, either at the query
level, or the mapping level.

For mapping level, you can use the EclipseLink @JoinFetch annotation or xml
to always join the relationship from Courses to Course.  You could also use
a DescriptorCustomizer to set enable batch reading on the OneToOneMapping
for course.



Joe Mc. wrote:
> 
> Hi,
> 
> I am playing with additional columns in join tables.
> The following example:
> Customer visits some Courses
> This n-m-Relation contains additional attributes in the n-m-table (join
> table), for example: note, year etc.
> 
> One solution is to use @OneToMany and @ManyToOne with a concret join table
> in Java, insteed of @ManyToMany.
> In this Association class, is it possible to hold the additional columns
> This solution is fine and worked.
> 
> In @ManyToMany is it possible to tell EclipseLink, that he use only ONE
> Select statement, to get all the data from the different tables (with
> outer joins etc.).
> Is it possible to do this now with the OneToMany and ManyToOne?
> 
> At the moment I get a join of Customer and Courses. And EclipseLink fires
> for every Course, the customer holds, an additional SQL SELECT statement
> to get the data :-(
> 
> I general: I want the same SQL SELECT statement as in the ManyToMany case.
> Is it possible?
> 
> 
> Thanks for any advice!
> 
> Regards
> 
> M.Joe
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Join-Table-with-additional-columns%3A-One-SQL-Select-to-fetch-data--tp24304704p24307839.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top