Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can I do this with Hibernate ?

 
David Garratt
Ranch Hand
Posts: 212
Eclipse IDE Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have a web application which I want to sell, but leave the choice of back end database to the user, restricting the selection to mySQL, MS SQL or Oracle, can hibernate be used to reference all three platforms (assuming they have the same table/field and as far as possible data types defined). I don't want to have 3 versions of the application. I would like to deploy it in such a manner that the user can pick the database backend during the configuration phase.

I have a home brew solution that does this now so I am aware of the subtle differences in SQL data types and SQL syntax between the 3 database platforms ?

I'm sure someone must have done this so are there any pointers or suggestions on the best approach ?

Thanks

Dave
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can pragmatically configure hibernate.
http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#configuration-programmatic

You will have to have some way of remembering their selections (other than storing it in a database) so that you can configure it on start-up. The only difference from one to the next is probably going to be the Dialect, make sure you use a generation strategy that is compatible with all types (like Table).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic