Hibernate Job Interview Questions

Answer  
# 1 1.You must have a default no-argument constructor for your persistent classes and there should be getXXX() (i.e accessor/getter) and setXXX( i.e. mutator/setter) methods for all your persistable instance variables.

2.You should implement the equals() and hashCode() methods based on your business key and it is important not to use the id field in your equals() and hashCode() definition if the id field is a surrogate key (i.e. Hibernate managed identifier). This is because the Hibernate only generates and sets the field when saving the object.


3. It is recommended to implement the Serializable interface. This is potentially useful if you want to migrate around a multi-processor cluster.

4.The persistent class should not be final because if it is final then lazy loading cannot be used by creating proxy objects.

5.Use XDoclet tags for generating your *.hbm.xml files or Annotations (JDK 1.5 onwards), which are less verbose than *.hbm.xml files.
Answer Submitted by: Admin
Is This Answer Correct?    11 Yes 1 No
Submit New Question Place Your Answer

Previous Interview QuestionNext Interview Question
How would you reatach detached objects to a session when the same object has already been loaded into the session?What does ORM consists of?

Top: What are the general considerations or best practices for defining your Hibernate persistent classes?
Hibernate Job Interview Question


Top Frequently Asked Hibernate Question
Frequently Asked Hibernate Job Interview Question


Top Frequently opened Java Programing Job Interview categories
Most popular Java Programing Job Interview categories

Comments About What are the general considerations or best practices for defining your Hibernate persistent classes?

Share your valuable opinions, ideas and suggestions about What are the general considerations or best practices for defining your Hibernate persistent classes?
While placing your comment your email address is required but won't be published any where else; Personal information will be kept confidential; we do not sell or release our respective visitors private information.
  1. Webmaster 23rd of May 2012

    Webmaster Said

    Tell us what you feel about What are the general considerations or best practices for defining your Hibernate persistent classes?
    All comments will be published after review. No login or registration is required to post a comment on What are the general considerations or best practices for defining your Hibernate persistent classes? We offer and invite you to submit your valuable comment now; Please be respectful of others when commenting. Insulting others, self-promotional comments, website promotional comments, marketing stuff, SEO Techniques, SMS-style content and off-topic comments will not be approved at this information portal.
    So start sharing your thoughts regarding What are the general considerations or best practices for defining your Hibernate persistent classes?
    Thank you.

Leave a Comment

Leave a Comment
  1.  Enter This Verification Code  Regenerate Verification Code  



Your reply will be added to the comment above (Below any other replies to this comment) -

Top Comments About: What are the general considerations or best practices for defining your Hibernate persistent classes?
Comments on What are the general considerations or best practices for defining your Hibernate persistent classes?

 
Top of Link batk to What are the general considerations or best practices for defining your Hibernate persistent classes?
Link batk to What are the general considerations or best practices for defining your Hibernate persistent classes?