[jboss-jira] [JBoss JIRA] Resolved: (JBAS-4988) EJB3: cannot auto-generate tables according to persistence.xml?
Carlo de Wolf (JIRA)
jira-events at lists.jboss.org
Tue Jun 10 05:16:15 EDT 2008
[ http://jira.jboss.com/jira/browse/JBAS-4988?page=all ]
Carlo de Wolf resolved JBAS-4988.
---------------------------------
Resolution: Cannot Reproduce Bug
Use the forums for questions.
> EJB3: cannot auto-generate tables according to persistence.xml?
> ---------------------------------------------------------------
>
> Key: JBAS-4988
> URL: http://jira.jboss.com/jira/browse/JBAS-4988
> Project: JBoss Application Server
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: EJB3
> Affects Versions: JBossAS-4.2.2.GA
> Environment: jboss4.2.2(default mode), JDK1.6, postgresql 8.2
> Reporter: cai jc
> Assigned To: Carlo de Wolf
>
> An J2EE application.containing a EJB module and a Web module.In EJB module,a persistence.xml exists:
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence>
> <persistence-unit name="caijc">
> <jta-data-source>java:/PostgresDS</jta-data-source>
> <property name="hibernate.show_sql">true</property>
> <property name="hibernate.hbm2ddl.auto" value="create"/>
> </persistence-unit>
> </persistence>
> There is no any error on deploy-time:
> [JmxKernelAbstraction] installing MBean: persistence.units:ear=cjc.ear,jar=cjc-ejb.jar,unitName=caijc with dependencies:
> 06:13:38,703 INFO [JmxKernelAbstraction] jboss.jca:name=PostgresDS,service=DataSourceBinding
> 06:13:39,000 INFO [PersistenceUnitDeployment] Starting persistence unit persistence.units:ear=cjc.ear,jar=cjc-ejb.jar,unitName=caijc
> 06:13:39,031 INFO [Ejb3Configuration] found EJB3 Entity bean: net.cjc.entity.Author
> 06:13:39,031 INFO [Ejb3Configuration] found EJB3 Entity bean: net.cjc.entity.Book
> 06:13:39,046 INFO [Configuration] Reading mappings from resource : META-INF/orm.xml
> 06:13:39,046 INFO [Ejb3Configuration] [PersistenceUnit: caijc] no META-INF/orm.xml found
> 06:13:39,046 INFO [AnnotationBinder] Binding entity from annotated class: net.cjc.entity.Author
> 06:13:39,046 INFO [EntityBinder] Bind entity net.cjc.entity.Author on table tbl_Authors
> 06:13:39,078 INFO [AnnotationBinder] Binding entity from annotated class: net.cjc.entity.Book
> 06:13:39,078 INFO [EntityBinder] Bind entity net.cjc.entity.Book on table tbl_Books
> 06:13:39,109 INFO [ConnectionProviderFactory] Initializing connection provider: ....
> But when I access the related EJB service(an INSERT execution),an exception is thrown:
> 421 ERROR [JDBCExceptionReporter] batch operation 0insert into tbl_Authors (birthday, levels, name) values (2007-11-19 +00:00:00, 5, me)failed?
> 07:53:39,421 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 42P01
> 07:53:39,421 ERROR [JDBCExceptionReporter] ERROR: relation "tbl_authors" does not exist
> 07:53:39,421 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
> org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
> at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
> at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
> at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
> at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:237)
> Yes,No tables are created automatically,even if I've specified "hibernate.hbm2ddl.auto" to "create" in persistence.xml.
> If I created these tables manurally,everything is ok.
> So is this a bug? or my fault?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list