Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Related records as a non-entity collection(How to load related table records as a set of a basic (non-entity) type?)
icon5.gif  Related records as a non-entity collection [message #491968] Fri, 16 October 2009 19:56 Go to next message
LexLythius  is currently offline LexLythius Friend
Messages: 2
Registered: October 2009
Junior Member
I have a table FOO represented by an entity class Foo. Each row in FOO can have 0 or more related rows in table FOO_TS. The latter is a very simple table with only one value field (a timestamp) and a key field (fooId) to associate with the main table.

Question is: how can I get all corresponding FOO_TS timestamps into a collection field in class Foo, without creating an entity class for those timestamps? It would be a burden to add a PK field+index into table BAR for just that purpose. By the same token, I want to avoid making a FooTimestamp entity with a composite PK or something of that sort.

Something like this:

class Foo {
  private Integer fooId;

  private Set<Timestamp> timestamps = new HashSet<Timestamp>();


Thanks for any help
Re: Related records as a non-entity collection [message #492235 is a reply to message #491968] Mon, 19 October 2009 14:37 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

In EclipseLink you can use an @BasicCollection for this, or in EclipseLink 1.2 and JPA 2.0 you can use an @ElementCollection. ion#Basic_Collections

James : Wiki : Book : Blog : Twitter
Previous Topic:Random deadlock/hang during commit in EJB3 application
Next Topic:be able to specify JDBC driver jar w/o adding it to manifest
Goto Forum:

Current Time: Sun Mar 29 22:13:37 GMT 2020

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

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

Back to the top