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 10:23 Go to next message
Frank Schwarz is currently offline Frank Schwarz
Messages: 25
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
Frank
Re: unidirectional one-to-many mapping with join column [message #378594 is a reply to message #377458] Tue, 05 August 2008 09:38 Go to previous message
James is currently offline James
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: Wed Jul 30 01:16:01 EDT 2014

Powered by FUDForum. Page generated in 0.01788 seconds