Pojo in Hibernate

来源:互联网 发布:rose only和beast 知乎 编辑:程序博客网 时间:2024/06/08 13:50

We should follow below rules when we are creating pojo in Hibernate:

1. We need a no argument constructor for every persistent class.

2. The pojo doesn't need to implement the serializable. However, if the pojo will be stored in http session or transmitted accross the clustering, it should implement the serializable.

3. the member variables don't need be private, could be private or protected, there should be setXXX() and getXXX() accompany with these member variables, but they are not necessory, hibernate will use field directly or through the access methord to access the member variable.

原创粉丝点击