Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Hibernate questions

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Does Hibernate always require a "join table" to create association between two tables ? Is it possible to use the foreign key constraint in the database instead of having a separate join table ?

Also if I were creating a data model, are there special considerations that I should keep in mind when I know that Hibernate will be using the data model ?

Thanks,

J.C
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depending on your association/relationship, a join table is not required. It would be required in a many to many scenario, but not many to one or one to many.

There are a few things to bear in mind when writing java classes that will be mapped with Hibernate to a relational database. You generally need a no args constructor (although due to Hibernate's trickery) this doesnt need to be public.

You will also need to think about identity of hibernate persisted objects. This may mean adding an indentity property that you otherwise wouldnt need to access.

Hope this helps.

Rosco
 
Are you okay? You look a little big. Maybe this tiny ad will help:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic