-->
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: Basic mapping problem?
PostPosted: Wed Jul 12, 2006 8:01 am 
Newbie

Joined: Tue Jul 11, 2006 9:47 am
Posts: 19
Hi

I am having what seems to be a pretty basic mapping problem, well not that basic considering I cant seem to find a solution.

I have this problem... (using simple data and not my actual database)

I have two tables in my database lets say Table 1 = Cat and Table 2 = Kittens so the relationship is a one-to-many and many-to-one depending which table you talking from.

Cat table has the following columns "id, name" and the Kitten table has these columns "id, kitten_name, cat_id" so the cat_id is a foreign key which references the Cat tables ID field. My Java objects look like this

Cat.class
int id;
String name
List<Kitten> kittens;

Kitten.class
int id;
String kitten_name;

From that I'd really appreciate it if you could supply what my mapping should look like keeping in mind I dont want to have an extra column in my database which has the index_order column that the <list> mapping normally adds. IE my table structure for Cat and Kittens should remain exactly the same while maintaining the one-to-many relationship

I'd like to create a list of Kitten objects and simple set the list in the Cat class with a List of Kitten objects and would like that information saved to the database, parent as well as children (Cat and its Kittens) possibly using cascade=""?

Thank you
MrJones


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.