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
|