2 Replies Latest reply on May 25, 2009 12:55 PM by jamesjmp

    Couldn't connect to database

      Hi,
      I'm using JBoss Developer Studio 2.0.0.CR2,jboss-5.0.0.GA.


      I added two tables to my project...
      While Generating Seam Entities, It Couldnt not connect to database.


      The Details are,


      Can't generate seam entities
        org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
        Could not create JPA based Configuration
          org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
          Could not create JPA based Configuration
          java.lang.reflect.InvocationTargetException: no message
          java.lang.reflect.InvocationTargetException
          javax.persistence.PersistenceException: org.hibernate.AnnotationException: Use of the same entity name twice: ItemDetails
          org.hibernate.AnnotationException: Use of the same entity name twice: ItemDetails
          org.hibernate.AnnotationException: Use of the same entity name twice: ItemDetails
          Use of the same entity name twice: ItemDetails
          org.hibernate.DuplicateMappingException: duplicate import: ItemDetails refers to both ItemDetails and com.sans.erp.entity.ItemDetails (try using auto-import false)
          duplicate import: ItemDetails refers to both ItemDetails and com.sans.erp.entity.ItemDetails (try using auto-import false)

        • 1. Re: Couldn't connect to database

          are you using some tools like seam-gen or JBoss Tools?

          • 2. Re: Couldn't connect to database

            check your projectName-dev-ds.xml


            You should have something like this:



            <datasources>
               
               <local-tx-datasource>
                  <jndi-name>yourProjectDatasource</jndi-name>
                  <connection-url>yourproperDatabaseUrlConnection</connection-url>
                  <driver-class>yourproperdriver. Forexamplecom.sybase.jdbc2.jdbc.SybDriver</driver-class>
                  <user-name>yourDatabaseUser</user-name>
                  <password>yourDatabasePassword</password>
                  <min-pool-size>1</min-pool-size>
                 <max-pool-size>20</max-pool-size>
                 <idle-timeout-minutes>15</idle-timeout-minutes>
                 <exception-sorter-class-name>ProperSorter. For example org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter</exception-sorter-class-name>
                 <type-mapping>ProperSorter. For example Sybase</type-mapping>
            
               </local-tx-datasource>
                
            </datasources>
            



            Both JBoss tools and seam gen helps you to generate and configure that file.