Hi,
I have
Code:
<property name="hbm2ddl.auto">create</property>
turned on in my hibernate.cfg.xml file. The table generator doesn't generate what I expect for
Code:
<generator/>
elements of the various persisted classes.
For the mapping doucments listed below I would expect there to be three columns in the database for the
Code:
hibernate_seq
table (categoryid, itemid, and userid). However only categoryid is generated.
Any help would be appreciated. I have search the documentation and forums.
Thanks,
Michael
Hibernate version: 3.0.5
Mapping documents:<class name="Category" table="category">
<id name="categoryId" column="categoryid">
<generator class="hilo">
<param name="table">hibernate_seq</param>
<param name="column">categoryid</param>
<param name="max_lo">10</param>
</generator>
</id>
...
</class>
<class name="Item" table="item">
<id name="itemId" column="itemid">
<generator class="hilo">
<param name="table">hibernate_seq</param>
<param name="column">itemid</param>
<param name="max_lo">10</param>
</generator>
</id>
...
</class>
<class name="User" table="user">
<id name="userId" column="userid">
<generator class="hilo">
<param name="table">hibernate_seq</param>
<param name="column">userid</param>
<param name="max_lo">10</param>
</generator>
</id>
...
</class>
Code between sessionFactory.openSession() and session.close():N/A
Full stack trace of any exception that occurs:org.hibernate.exception.SQLGrammarException: could not get or update next value
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:85)
at org.hibernate.id.TableGenerator.generate(TableGenerator.java:94)
at org.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.java:61)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:85)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
at com.idealoutcome.eauction.testing.HibernateTesting.main(HibernateTesting.java:36)
Caused by: java.sql.SQLException: Column not found message from server: "Unknown column 'categoryid' in 'field list'"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2247)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
at org.hibernate.id.TableGenerator.doWorkInCurrentTransaction(TableGenerator.java:133)
at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:64)
... 11 more
Exception in thread "main"
Name and version of the database you are using:MySQL 4.0.14-nt
The generated SQL (show_sql=true):Debug level Hibernate log excerpt:Code: