-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to Persist an Array of List Objects and their children
PostPosted: Mon Jul 28, 2008 6:03 pm 
Newbie

Joined: Tue May 06, 2008 11:36 am
Posts: 1
I have a question that I am trying to solve in applying Hibernate/Annotations, is it of one-many and many-many associations or something else.

If I have three classes that I want to persist:

The top class is e.g., 1) SimModel - only one of these exists during run time.
second class 2) PlatformList - -- public class PlatformList extends LinkedList<PlatformModel> {..
third is 3) PlatformModel - e.g. identifies a vehicle object

And I declare PlatformList as an array in SimModel, ie, PlatformLists[ ] platforms, the array will hold two platform lists, e.g Red, containing red platforms ; and Blue, containting blue platforms, ie, :

public class SimModel implements Serializable {

public static int RED = 0;
public static int BLUE = 1;
private PlatformList[ ] platforms;
..
public SimModel() {
platforms = new PlatformList[2]; //array of two lists Red and Blue
platforms[RED] = new PlatformList();
platforms[BLUE] = new PlatformList();
}
..
}

There are many unique PlatformModel objects in the Red and Blue list objects.

My Question is would SimModel have a 1:1 relationship with PlatformList or 1 : many relationship, since its declared as an array in SimModel??

Do I need to use Collections of element annotations?? and help on how to proceed with this is appreciated from Newbie.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.