Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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: Fri Jul 04 11:21:18 EDT 2025

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

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

Back to the top