Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate tips: inner table  RSS feed

 
German Gonzalez-Morris
Ranch Hand
Posts: 290
Eclipse IDE Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when there is a many to many relationship we know will be a physical table to resolve it, however we may remive one of the entity table to gain performance. Is it possible to do a similar hack with Hibernate ?
 
German Gonzalez-Morris
Ranch Hand
Posts: 290
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I meant "Associative Table"
 
Tim Holloway
Saloon Keeper
Posts: 18636
70
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate isn't magic. If you want a many-to-many association, you do need an association table. If you do not explicitly map one, Hibernate will construct and use one itself. If it does, it will synthesize the name of the table and the linking (foreign key) fields according to well-defined rules as given in the Hibernate documentation.

Needless to say, you generally don't want to eager-fetch everything on a many/many relationship.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!