Seam 2.2 with AS 5.1 and hibernate not working
zeeman Jan 25, 2010 4:01 AMI have a new project that used to work in seam 2.1 deployed as a WAR. I used seam-gen from 2.2 to generate a new project. I copied my code to newly generated project and updated the schema declaration in xml files to 2.2. I have changed components.xml and persistance.xml to match Seam 2.2 examples (JPA one). I'm getting below error when I start the app server.
If I comment out the import script I get EMF is not bound exception. Not sure if it's an issue with EMF and EM config or something else.
`
2010-01-24 20:18:38,609 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (main) schema export unsuccessful
org.hibernate.JDBCException: Error during import script execution at line 1
at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:332)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:264)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:211)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:343)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
Caused by: java.sql.SQLException: Table not found in statement [INSERT INTO properties]
`
I have an import script that inserts few rows in a properties table. For some reason hibernate is not finding my entity classes and not generating the DB schema.
I have commented out the persistence-unit-ref node in web.xml.
Data source:
<local-tx-datasource>
<jndi-name>myProjectdatasource</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:hsqldb:mydb</connection-url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<user-name>sa</user-name>
<password></password>
</local-tx-datasource>
persistence.xml:
<persistence-unit name="myDS" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>myProjectdatasource</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/myprojectEMF"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
</properties>
</persistence-unit>
components.xml:
<core:init debug="@debug@" jndi-pattern="@jndiPattern@" />
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000" conversation-id-parameter="cid"
parent-conversation-id-parameter="pid" />
<web:hot-deploy-filter url-pattern="*.seam" />
<transaction:entity-transaction entity-manager="#{entityManager}" />
<persistence:entity-manager-factory name="entityManagerFactory" installed="false" />
<persistence:managed-persistence-context
name="entityManager" auto-create="true" entity-manager-factory="#{entityManagerFactory}"
persistence-unit-jndi-name="java:/myprojectEMF" />
If I comment out the import script I get EMF is not bound exception. Not sure if it's an issue with EMF and EM config or something else.
`
2010-01-24 20:18:38,609 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (main) schema export unsuccessful
org.hibernate.JDBCException: Error during import script execution at line 1
at org.hibernate.tool.hbm2ddl.SchemaExport.importScript(SchemaExport.java:332)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:264)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:211)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:343)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132)
at org.jboss.jpa.deployment.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:301)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
Caused by: java.sql.SQLException: Table not found in statement [INSERT INTO properties]
`
I have an import script that inserts few rows in a properties table. For some reason hibernate is not finding my entity classes and not generating the DB schema.
I have commented out the persistence-unit-ref node in web.xml.
Data source:
<local-tx-datasource>
<jndi-name>myProjectdatasource</jndi-name>
<use-java-context>false</use-java-context>
<connection-url>jdbc:hsqldb:mydb</connection-url>
<driver-class>org.hsqldb.jdbcDriver</driver-class>
<user-name>sa</user-name>
<password></password>
</local-tx-datasource>
persistence.xml:
<persistence-unit name="myDS" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>myProjectdatasource</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/myprojectEMF"/>
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
</properties>
</persistence-unit>
components.xml:
<core:init debug="@debug@" jndi-pattern="@jndiPattern@" />
<core:manager concurrent-request-timeout="500"
conversation-timeout="120000" conversation-id-parameter="cid"
parent-conversation-id-parameter="pid" />
<web:hot-deploy-filter url-pattern="*.seam" />
<transaction:entity-transaction entity-manager="#{entityManager}" />
<persistence:entity-manager-factory name="entityManagerFactory" installed="false" />
<persistence:managed-persistence-context
name="entityManager" auto-create="true" entity-manager-factory="#{entityManagerFactory}"
persistence-unit-jndi-name="java:/myprojectEMF" />