Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » OneToMany two times
OneToMany two times [message #454260] Sat, 01 August 2009 17:26 Go to next message
Omar Diego Vera Ustariz is currently offline Omar Diego Vera UstarizFriend
Messages: 4
Registered: July 2009
Junior Member
Hi all,

I am writing my entities and due to my modeling I have a OneToMany
relationship between two Entities, of course both relationships have a
different meaning. However when I see the data base only one table with
three columns was created representing the relationship. I was expecting
to have two relationship tables each representing a relationship. Is there
a way to model two OneToMany relationships between two Entities creating a
different table for every relationship?

Thanks in advance,

-Omar Diego
Re: OneToMany two times [message #480783 is a reply to message #454260] Tue, 18 August 2009 13:21 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You must use the @JoinTable annotation whenever you have two
OneToMany/ManyToMany relationships to the same class. This is because the
JPA defined defaulting auto-mapping rules require using the
<source>_<target> as the default table name, as normally it is the best
name to use, but of course does not work if you have multiple
relationships.

Also please log a bug that a warning or error message should be logged if
there are multiple OneToMany/ManyToMany relationships to the same class
(or a different naming strategy should be used in the case of multiple).

---
James


James : Wiki : Book : Blog : Twitter
Previous Topic:interfaces
Next Topic:ManyToOne only have the IDs in a collection not the whole object
Goto Forum:
  


Current Time: Fri Apr 19 04:32:59 GMT 2024

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

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

Back to the top