• Post Reply Bookmark Topic Watch Topic
  • New Topic

Do we create our own tables in or do we let Hibernate do it for us?  RSS feed

 
P Marksson
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am not sure what's best practice here:

1) Write our own SQL query to create all the tables, constraints and such and then create our entities which maps to the tables created.

or

2) Do not create any SQL queries. Just create the entities, annotate them properly and let Hibernate create the tables.

Some guidance?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36171
439
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I prefer option #1 because it ensures the schema will be the same in all environments and across time.
 
Rob Spoor
Sheriff
Posts: 20879
71
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree, #1 in combination with schema validation is my preferred solution.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!