Configuration for your own database server
OpenXava uses Hibernate for persistence, you need to indicate what database are you using in order that Hibernate generates the SQL statements with the correct syntaxt. You can choose any of the
supported Hibernate dialects.
JPA entities (OX3 style)
For example, if you want to change from Hypersonic (the default when you create an OpenXava project) to Oracle you have to,
if you are using OX3, edit the file
persitence/META-INF/persistence.xml of your project, and change:
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
by
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
If you wish to make junit test (to test CRUD) or execute the ant task "updateSchema", you also need to modify the persistence unit with this:
<persistence-unit name="junit">
<properties>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:XE"/>
<property name="hibernate.connection.username" value="user"/>
<property name="hibernate.connection.password" value="password"/>
</properties>
</persistence-unit>
Likewise, if you wish your application database server to manage the user preferences tab (in this case Oracle) you need to modify the file
persistence/openxava-hibernate.cfg indicating the correct datasource and dialect:
<session-factory>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/MyApplicationDS</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.jdbc.use_get_generated_keys">false</property>
<mapping resource="TabUserPreferences.hbm.xml"/>
</session-factory>
No more.
XML components (classic style)
In the other hand, if you are using OX2 you need to copy and paste the file
tomcat-hypersonic.properties, in the root of your project, to
tomcat-oracle.properties, edit this last file, and change this line:
hibernate.dialect=org.hibernate.dialect.HSQLDialect
for this one:
hibernate.dialect=org.hibernate.dialect.OracleDialect
Then edit the file
build.xml of your project and change:
<property name="configuration" value="tomcat-hypersonic" />
by
<property name="configuration" value="oracle-hypersonic" />