Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Customizing @ManyToOne?

You can do this using a DescriptorCustomizer and set the selectionSQLString
on the OneToOneMapping.

mapping.setSelectionSQLString("Select * from Foo f, Bar, b where ... and
f.bar_id = #BAR_ID");

Note "#" is used in custom SQL for parameters.

See,
http://www.eclipse.org/eclipselink/api/1.1.1/org/eclipse/persistence/mappings/ForeignReferenceMapping.html#setSelectionSQLString(java.lang.String)



ljnelson wrote:
> 
> I have a VERY complicated join in a legacy database I can't change.  I
> would
> like a child object in this context to be able to navigate to his parent
> via
> a @ManyToOne operation.  However, there is no direct link from the child
> to
> the parent.  In SQL, I need to go through several INNER JOIN clauses to
> ultimately arrive at the proper destination.
> 
> How would I go about customizing this relationship in EclipseLInk?  Is
> there
> somewhere I can tell EclipseLink that when someone calls child.getParent()
> I
> would like it to run this large query instead?
> 
> I had a look at
> http://wiki.eclipse.org/Customizing_the_EclipseLink_Application_%28ELUG%29but
> didn't really know what to look for.
> 
> Thanks,
> Laird
> 
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
> 
> 


-----
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/Customizing-%40ManyToOne--tp24541521p24698091.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top