Hibernate - One design problem

Posted by Yatendra Goel on Stack Overflow See other posts from Stack Overflow or by Yatendra Goel
Published on 2010-03-12T17:54:38Z Indexed on 2010/03/12 17:57 UTC
Read the original article Hit count: 180

Filed under:
|

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; 

`

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about java