This content has been marked as final.
Show 2 replies
-
1. Re: Can you omit hibernate.dialect in persistence.xml?
peterj Sep 29, 2008 11:30 AM (in response to dweil)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.) -
2. Re: Can you omit hibernate.dialect in persistence.xml?
shelly.mcgowan Sep 29, 2008 12:26 PM (in response to dweil)The dialect should be automatically detected. Or it can be set explicitly in the $JBOSS_HOME/server/config/deploy/ejb3.deployer/META-INF/persistence.properties. Auto-detection for DB2 was recently added so depends on the Hibernate version you are currently using. See:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2630