Using the mysql for openxava

In order to use the mysql database for openxava (version 5.7.1), the following changes need to be made in the project and Tomcat server.

Copy a MySQL connector file to the Tomcat lib directory. (../openxava-5.7.1/tomcat/lib) and the project lib directory.

Example for a project called Abd.

In the Tomcat server, file context.xml (database abd)

   <Resource name="jdbc/AbdDS" auth="Container" type="javax.sql.DataSource"
          maxActive="20" maxIdle="5" maxWait="10000"
          username="dbuser" password="userpw" 
          driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://localhost:3306/abd"/>

In the project Abd.
persistence->META-INF file persistence.xml
     <!-- Tomcat + Mysql -->
     <persistence-unit name="default">
         <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
         <non-jta-data-source>java:comp/env/jdbc/AbdDS</non-jta-data-source>
         <class>org.openxava.session.GalleryImage</class>
         <class>org.openxava.web.editors.DiscussionComment</class>
         <properties>
                 <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
        </properties>
    </persistence-unit>

and

 <!-- JUnit Mysql -->
    <persistence-unit name="junit">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <class>org.openxava.web.editors.DiscussionComment</class>
        <properties>
         <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
         <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/abd"/>
        </properties>
    </persistence-unit>

and in the project folder's build.xml (Example Abd->build.xml)

    <target name="updateSchema">
         <ant antfile="../OpenXava/build.xml" target="updateSchemaJPA">                                     
         <property name="persistence.unit" value="junit"/>
         <property name="schema.path" value="../Abd/lib/mysql-connector-java-5.1.32-bin.jar"/>
       </ant>
  </target>

and in persistence->hibernate.cfg.xml

        <!-- Tomcat + Mysql -->
        <property name="hibernate.connection.datasource">java:comp/env/jdbc/AbdDS</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.jdbc.use_get_generated_keys">false</property>                            
        <property name="hibernate.show_sql">false</property>

Rebuild the project and OpenXava will use the mysql database.