2 Replies Latest reply on Aug 11, 2009 3:38 PM by Walter Butrymowicz

    newbie -- seam, websphere 7 and mysql confusion

    Walter Butrymowicz Newbie

      I am tasked to test seam 2.1.2 under websphere 7 nd. I am to use MySQL as the DB for this. I followed instructions for WebSphere Seam Booking jee build and got it to work - now I need to make it work with MySQL. I've done research and can't find conclusively what must be changed to allow seam to create the ear file that I want to deploy.


      I spent yesterday loading MySQL and created a database and users with rights. I am able to connect to via test connections the new DB.


      So, please lead me by the hand -- what files must be changed, and with what mysql specific entries should I be using in those files ? I am working within the examples directories under the downloaded seam 2.1.2 .

        • 1. Re: newbie -- seam, websphere 7 and mysql confusion
          Denis Forveille Novice

          It seems you have already created a connection pool pointing to your database and tested in with the WAS console. The driver used for your connection pool must support XA transactions (not 100% sure of that and don't knoe the name of this driver..)


          So now, edit the META-INF/persistence.xml file and :



          • add the line <property name\="dialect">org.hibernate.dialect.MySQLDialect</property>

          • change the value of the <jta-data-source> tag to the JNDI name you set for your connection pool with the WebSphere console when you created it (e.g. jdbc/MySqlDatabase)



          Rebuild then redeploy

          • 2. Re: newbie -- seam, websphere 7 and mysql confusion
            Walter Butrymowicz Newbie
            Here following is the persistence file for the seam booking example.
            The change I introduced was similar to what you suggested.
            Thank you very much for putting me in the ball park.
            Your help was very much appreciated.


            <?xml version="1.0" encoding="UTF-8"?>
            <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                         version="1.0">
               <persistence-unit name="bookingDatabase">
                  <provider>org.hibernate.ejb.HibernatePersistence</provider>
                  <!-- use this data source name for Glassfish -->
                  <!-- <jta-data-source></jta-data-source> -->
                  <jta-data-source>jdbc/bookingDatabase</jta-data-source>
                  <properties>
                     <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                     <property name="hibernate.show_sql" value="true"/>
                     <!-- <property name="hibernate.transaction.flush_before_completion" value="true"/> -->
                     <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
                     <!-- <property name="hibernate.dialect" value="GlassfishDerbyDialect"/> -->
                     <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>
                     <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
                  </properties>
               </persistence-unit>
            </persistence>



            <blockquote>
            _Denis Forveille wrote on Aug 07, 2009 00:45:_<br/>

            It seems you have already created a connection pool pointing to your database and tested in with the WAS console. The driver used for your connection pool must support XA transactions (not 100% sure of that and don't knoe the name of this driver..)

            So now, edit the "META-INF/persistence.xml" file and :

            = add the line "|<property name\="dialect">org.hibernate.dialect.MySQLDialect</property>|"
            = change the value of the |<jta-data-source>| tag to the JNDI name you set for your connection pool with the WebSphere console when you created it (e.g. "jdbc/MySqlDatabase")

            Rebuild then redeploy

            </blockquote>

            Click HELP for text formatting instructions. Then edit this text and check the preview.