This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Can I do this with Hibernate ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Can I do this with Hibernate ?" Watch "Can I do this with Hibernate ?" New topic

Can I do this with Hibernate ?

David Garratt
Ranch Hand

Joined: Aug 08, 2003
Posts: 196

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 ?


Bill Gorder

Joined: Mar 07, 2010
Posts: 1648

You can pragmatically configure hibernate.

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).

[How To Ask Questions][Read before you PM me]
I agree. Here's the link:
subject: Can I do this with Hibernate ?
Similar Threads
JDBC Connections Freezing with Multiple Users Accessing DB
EJB and Hibernate
Regarding pl/sql
Hibernate Issue
PostGIS and spatial database