Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » unidirectional one-to-many mapping with join column
unidirectional one-to-many mapping with join column [message #377458] Mon, 04 August 2008 14:23 Go to next message
Frank Schwarz is currently offline Frank SchwarzFriend
Messages: 26
Registered: July 2009
Location: Dresden
Junior Member
Sorry if this question has been asked before.

I would like to map a unidirectional one-to-many relationship from Java to
a join-column in the database. I know that JPA1 does not specify this
mapping, however JPA2 is supposed to eliminate that omission.

Is there a way to achieve this mapping with current EclipseLink using
annotations or by an orm.xml mapping?

Kind regards
Re: unidirectional one-to-many mapping with join column [message #378594 is a reply to message #377458] Tue, 05 August 2008 13:38 Go to previous message
James is currently offline JamesFriend
Messages: 272
Registered: July 2009
Senior Member
This is something we are working on for EclipseLink 1.1. In EclipseLink
1.0 you can map the relationship using a DescriptorCustomizer and use
either a OneToManyMapping or AggregateCollectionMapping.

For the OneToManyMapping, you will need to map the foreign key in the
target object some how, either Basic or ManyToOne (of coarse then you
could just use JPA as normal).

For AggregateCollectionMapping the target object needs to be treated like
an Embeddable and marked as an aggregateCollectionDescriptor.

In general the best way to model a OneToMany is to either have a ManyToOne
back, or use a join table.

-- James
Previous Topic:@NamedStoredProcedureQuery
Next Topic:left side of the IN operator missing?
Goto Forum:

Current Time: Sun Apr 22 03:18:45 GMT 2018

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

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