Hibernate - One design problem
- by Yatendra Goel
I am learning Hibernate from the tutorial on JBoss website. I have a confusion in a code example located here.
There is a Cat class code at 4.1. A simple POJO example.
This Cat class has a reference to his mother as private Cat mother;
Q1. If the class has an identifier property as id, then wouldn't it be better to store the cat's mother's id instead of cat's mother object.
means instead of
private Cat mother;
wouldn't it be better to have
private long motherId;
`