1 Reply Latest reply on Oct 2, 2008 9:20 PM by eerriicc

    Seam example with postgres

    eerriicc

      Hello everyone!
      I´m running the booking example perfectly
      but I would like to change to postgres DB!
      How can I do that? please somebody help me!


      I´ve done that:
      obs: I remove the closed and opened tags...
      on booking/resources/META-INF/persistence.xml


      <persistence-unit name="bookingDatabase" transaction-type="JTA">
           <provider>org.hibernate.ejb.HibernatePersistence</provider>
           <jta-data-source>java:/PostgresDS</jta-data-source>
           <properties>
              <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
              <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
              <property name="hibernate.jdbc.batch_size" value="20"/>
              <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
           </properties>
        </persistence-unit>
      


      jboss-seam-booking-ds.xml:


      <datasources>  
           <local-tx-datasource>  
                <jndi-name>PostgresDS</jndi-name>
                <connection-url>jdbc:postgresql://127.0.0.1:5432/mydbtest</connection-url> 
                <driver-class>org.postgresql.Driver</driver-class> 
                <user-name>postgres</user-name> 
                <password>passwd</password> 
           </local-tx-datasource> 
      </datasources>
      

        • 1. Re: Seam example with postgres
          eerriicc

          IT´S Working!!!
          just details..... my two files are:


          file persistence.xml


          <?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" transaction-type="JTA">
               <provider>org.hibernate.ejb.HibernatePersistence</provider>
               <jta-data-source>java:/bookingDatasource</jta-data-source>
               <properties>
                  <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                  <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
                  <property name="hibernate.jdbc.batch_size" value="20"/>
                  <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
               </properties>
            </persistence-unit>
          
          </persistence>
          





          arquivo jboss-seam-booking-ds.xml


          <?xml version="1.0" encoding="UTF-8"?>
          
          <!DOCTYPE datasources
              PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
              "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
          
          <datasources>  
               <local-tx-datasource>  
                    <jndi-name>bookingDatasource</jndi-name>
                    <connection-url>jdbc:postgresql://localhost:5432/postgres</connection-url> 
                    <driver-class>org.postgresql.Driver</driver-class> 
                    <user-name>postgres</user-name> 
                    <password>passwd</password> 
               </local-tx-datasource> 
          </datasources>