Getting my webapp to be database agnostic with Hibernate...
- by JellyHead
So the ultimate in scope-creep came in the other day: since we're using Hibernate, could we make our webapp run on Oracle as well as MySQL, interchangably?
I thought this would be a simple case of changing hibernate.cfg.xml so that instead of explicity stating MySQL-specific options, it would reference a JNDI datasource, allowing the application to build regardless of the database we intend to deploy to. Then changing to a different database would simply mean changing the separate datasource configuration in JBoss, Jetty, WebLogic etc. Is this realistic?
Well, I got as far as setting that up in Jetty, but What's tripping me up right now is error about the hibernate.dialect not having been set in hibernate.cfg.xml. But If I set the dialect there, then my app is still going to be built in either MySQL or Oracle flavours, which is not really what I want.
Either I'm trying to attempt the impossible or I've missed something fundamentally obvious... anyone else had a similar problem (and subsequent solution/workaround)?