Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » ManyToOne only have the IDs in a collection not the whole object
ManyToOne only have the IDs in a collection not the whole object [message #454344] Sat, 01 August 2009 17:43 Go to next message
Philipp Kursawe is currently offline Philipp KursaweFriend
Messages: 135
Registered: July 2009
Senior Member
Hello!

I wonder if its possible to fetch only the IDs of the associated
collection objects instead of the full blown entity. Lets say I have a
User object hat can have 0..n orders assigned to him. But I only want to
have the order IDs in the collection in the User entity.
Collection<String> orders;
instead of
Collection<UserOrder> orders;

Any ideas?

Thanks
Phil
Re: ManyToOne only have the IDs in a collection not the whole object [message #480785 is a reply to message #454344] Tue, 18 August 2009 13:37 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You can use a @BasicCollection in EclipseLink (1.1) or an
@ElementCollection in JPA 2.0 (EclipseLink 2.0) to define this type of
relationship. You would probably also want to make the relationship
read-only.

---
James


James : Wiki : Book : Blog : Twitter
Previous Topic:OneToMany two times
Next Topic:Alias for identifier have more than 30 char. ora-00972 identifier too long
Goto Forum:
  


Current Time: Sat Sep 23 21:58:23 GMT 2017

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

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