Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Beginner Questions

 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a beginner in using the Hibernate. I have three questions need help:

1. How to index a key that is a combination of multiple table fields?

2. How does the Hibernate handle many-to-many relation?

3. What to do if a table field is read-only so that the field does not get updated?

Thank you very much in advance.
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My reply here will be very brief. So I'll leave more explanation to you as an exercise


1. How to index a key that is a combination of multiple table fields?

Use @Embaddable and @EmbaddableId for composite keys.


2. How does the Hibernate handle many-to-many relation?

Hibernate will create an association table with many-to-many entity associtation, i.e. @ManyToMany with @JoinTable.


3. What to do if a table field is read-only so that the field does not get updated?

You can call session.setReadOnly(object, true) to disable dirty checking for a particular instance.

Hope this helps.
 
Natalie Kopple
Ranch Hand
Posts: 325
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your guidance. It is all I need.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic