I have the following table structure:
Code:
bots
****
botid (long)
name (varchar)
subs
****
subid (long)
botid (long)
And the classes are:
Code:
public class Bot{
Long id;
Sub sub;
// setters and getters
}
public class Sub{
Long id;
// setters and getters
}
Looking at the table structure is reasonable to think that the Bot class should hold a "list" of instances of Sub.
But the actual administration interface is thought to assign only one Sub to each Bot.
Is there any one to map this?
The idea is to save a Bot and automatically save its Sub.
PS: I have not designed the class diagram neither the database structure, and I can't change it.
Thanks.