aspose file tools*
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Can I do this with Hibernate ?" Watch "Can I do this with Hibernate ?" New topic
Author

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 ?

Thanks

Dave
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1648
    
    7

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


[How To Ask Questions][Read before you PM me]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can I do this with Hibernate ?