I am new with Hibernate so sorry if this is stupid.
Consider this:
Code:
class Parent
{
long id;
List<Child> children = new List<Child>();
}
class Child
{
long id;
long parentId;
}
In database, Child table has a column parent_id with foreign key to Parent table.
In the Hibernate documentation, I generally find that examples are given when Child class actually has a reference of Parent class. But in my case, I only have the parentId.
So how do I map the parentId field of Child? Will using many-to-one work?
Thanks
P.S. I know i can just try and see but I dont have any developer tools/software. I am just designing a system.
Code:
Code: