Hello,
I'm doing what would seem to be a simple operation to save a bean to a table, which generates:
net.sf.hibernate.JDBCException: Could not execute JDBC batch update
I've tried removing the transaction code and doing a flush(), but have the same problem.
I've been going through the code for the last couple of days trying analyze what might be causing it. Class HibernateUtil is taken directly from the Hibernate Reference Manual.
Any ideas what might be causing this? Thanks!
Tomcat: tomcat-4.1.27
mySQL v 4.0.18
driver: com.mysql.jdbc.Driver
Hibernate: hibernate2.jar (12/03) - how to tell the specific version number?
<code>
public boolean regUser(MemberRegBean mrb) {
Session sess = null;
Transaction tx = null;
try {
sess = HibernateUtill.currentSession();
tx = sess.beginTransaction();
sess.save(mrbean);
tx.commit(); // ****** THIS GENERATES JDBCException ************
HibernateUtil.closeSession();
return true;
}
catch(HibernateException he) {
appLogger.debug("MemberDB regUser error: " + he);
return false;
}
}
============================
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.datasource">java:comp/env/jdbc/aft2121</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="show_sql">true</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!--Mapping files -->
<mapping resource="/com/aft2121/memberServicesBeans/MemberRegBean.hbm.xml"/>
<mapping resource="/com/aft2121/memberServicesBeans/PayrollRecordBean.hbm.xml"/>
<!--mapping resource="MemberRegBean.hbm.xml"/-->
</session-factory>
</hibernate-configuration>
=============================
<hibernate-mapping>
<class name="com.aft2121.memberServicesBeans.MemberRegBean" table="registration">
<id name="id" column="id" type="string">
<generator class="uuid.hex"/>
</id>
<property name="firstName" column="firstName" type="string"/>
<property name="lastName" column="lastName" type="string"/>
<property name="last4SSN" column="last4SSN" type="string"/>
<property name="areaCode" column="areaCode" type="string"/>
<property name="phoneNumber" column="phoneNumber" type="string"/>
<property name="email" column="email" type="string"/>
<property name="userID" column="userID" type="string"/>
<property name="passwd" column="passwd" type="string"/>
</class>
</hibernate-mapping>
==========================
DEBUG Thread-5 member_services_application - net.sf.hibernate.JDBCException: Could not execute JDBC batch update
</code>
With:
<code>
<property name="hibernate.jdbc.batch_size">0</property>
</code>
added to hibernate.cfg.xml, the same code above generates:
<code>
DEBUG Thread-4 member_services_application - net.sf.hibernate.JDBCException: could not insert: [com.aft2121.memberServicesBeans.MemberRegBean#ff808081fd11514b00fd11514ee20001]
Code:
Code:
Code:
Code: