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

Just starting with Hibernate

 
Nigel Shrin
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using MySQL. Do the tables need to be joined with fk indexes in MySQL, or do you manage all the relationships within Hibernate?
(Using MyEclipse).
thanks
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Regardless of how you access your data, the data model is key. Define constraints there and you can trust your data to stay consistant regardless of what client applications access it.
 
Nigel Shrin
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul - I ask because my first attempt at Hibernate has issues with composite ids and foreign keys, so I am not sure yet at what level the problem exists.
Cheers,
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally composite ids complicate data modelling, and there is no real need for them. If you can change your data model I would recommend adding surrogate keys and defining unique indices to replace the composite keys. Things will be much cleaner and easy to use that way.
 
Nigel Shrin
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's worked thanks Paul! changed the DB structure and now have Hibernate up and running in MyEclipse.

I'm just starting JSP/Hibernate, no JSP yet, are you able to recommend a resource?

The project is a website with a lot of interaction with a MySQL db.

thanks again


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic