[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Can you omit hibernate.dialect in persistence.xml?

PeterJ do-not-reply at jboss.com
Mon Sep 29 11:30:53 EDT 2008

Not sure if this will work but it is worth a try. Set the property using a system property like this:

<property name="hibernate.dialect" value="org.hibernate.dialect.${my.hibernate.dialect:MySQL5}Dialect"/>

Then when you run the app server, set -Dmy.hibernate.dialect=DB2 on the command line to use DB2. If this option is missing, the above line uses he MySQL dialect by default.

The above makes use of the ability of JBoss AS to replace system properties within configuration file.  I am not sure that it will work for the Hibernate config files.

And I have another thought - perhaps you can override the dialect by setting -Dhibernate.dialect on the command line. (Not sure if this works either, I have not looked this up in the docs nor looked at the code to see if it might work but a grep for "hibernate.dialect" in the source code should verify if this is possible.)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4179407#4179407

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4179407

More information about the jboss-user mailing list