I have a simple object that I am trying to save. I get a JBoss exception as shown below. It must have something to do with using the Hibernate hilo id generator. Any ideas?
JBoss4 throws :
2004-10-31 16:39:36,323 WARN [net.sf.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: null
2004-10-31 16:39:36,323 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] You cannot commit during a managed transaction!
2004-10-31 16:39:36,326 ERROR [net.sf.hibernate.util.JDBCExceptionReporter] Could not save object
java.sql.SQLException: You cannot commit during a managed transaction!
code:
Code:
Transaction tx = session.beginTransaction();
QuoteUser qu = new QuoteUser();
qu.setPassword("patrick");
qu.setUsername("patrick");
session.save(qu);
tx.commit();
session.close();
Mapping:
Code:
<hibernate-mapping>
<class name="net.pwb.quoteserver.vo.QuoteUser"
table="quoteuser">
<id name="userid" type="long"
unsaved-value="null">
<column name="userid" sql-type="integer"
not-null="true"/>
<generator class="hilo"/>
</id>
<property name="username">
<column name="username" sql-type="char(25)"
not-null="true"/>
</property>
<property name="password">
<column name="password" sql-type="char(25)"
not-null="true"/>
</property>
</class>
</hibernate-mapping>
[/code]