• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Many-To-Many mapping in hibernate

 
Deepaks Deshpande
Ranch Hand
Posts: 114
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
Please explain hibernate many-to-many mapping with the help of a simple example.
I referred the following link http://viralpatel.net/blogs/hibernate-many-to-many-annotation-mapping-tutorial to understand, but i am still in doubt if the table structure is already created in the database by the user or does hibernate create it for us as in case of One-To-Many or Many-To-One mappings.

Thank you.
 
Nam Ha Minh
Ranch Hand
Posts: 508
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course you have to create the database and mappings yourself. Hibernate only manages the entities and generate queries for you.
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether hibernate creates the tables or not has nothing to do with whether the relationship is many to many or one to many. It is determined by the value you set for the property hibernate.hbm2ddl.auto in your configuration.
 
Deepaks Deshpande
Ranch Hand
Posts: 114
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone please explain the same with an example
 
Nam Ha Minh
Ranch Hand
Posts: 508
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepaks Deshpande wrote:Can anyone please explain the same with an example


Here's a pretty good one:
Hibernate Many-to-Many Association Annotations Example
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic