Hibernate version:2.1.6
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="com.dqian.database">
<class name="UserInfo" table="USER_INFO">
<id
column="USER_ID"
name="Id"
type="integer"
>
<generator class="vm" />
</id>
<property
column="USER_ADDR"
length="200"
name="UserAddr"
not-null="false"
type="string"
/>
<property
column="USER_OTHER"
length="100"
name="UserOther"
not-null="false"
type="string"
/>
<property
column="USER_MOBILE"
length="40"
name="UserMobile"
not-null="false"
type="string"
/>
<property
column="USER_PW"
length="40"
name="UserPw"
not-null="true"
type="string"
/>
<property
column="USER_INFO"
length="400"
name="UserInfo"
not-null="false"
type="string"
/>
<property
column="USER_EMAIL"
length="40"
name="UserEmail"
not-null="false"
type="string"
/>
<property
column="USER_PHONE"
length="40"
name="UserPhone"
not-null="false"
type="string"
/>
<property
column="USER_RNAME"
length="20"
name="UserRname"
not-null="false"
type="string"
/>
<property
column="USER_PRIV"
length="20"
name="UserPriv"
not-null="true"
type="string"
/>
<property
column="USER_NAME"
length="40"
name="UserName"
not-null="true"
type="string"
/>
<many-to-one
class="SupDem"
name="UserSd"
not-null="true"
>
<column name="USER_SD" />
</many-to-one>
<many-to-one
class="Enterprise"
name="UserEnter"
not-null="true"
>
<column name="USER_ENTER" />
</many-to-one>
<many-to-one
class="Product"
name="UserPro"
not-null="true"
>
<column name="USER_PRO" />
</many-to-one>
<set inverse="true" name="PRODUCTSet">
<key column="PRO_USER" />
<one-to-many class="Product" />
</set>
<set inverse="true" name="ENTERPRISESet">
<key column="ENTER_USER" />
<one-to-many class="Enterprise" />
</set>
<set inverse="true" name="SupDemSet">
<key column="SD_USER" />
<one-to-many class="SupDem" />
</set>
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Transaction tx = s.beginTransaction();
s.save(ui);
s.flush();
tx.commit();
s.close();
Full stack trace of any exception that occurs:
net.sf.hibernate.JDBCException: Could not execute JDBC batch update
net.sf.hibernate.impl.BatcherImpl.executeBatch(BatcherImpl.java:129)
net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2385)
net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2335)
net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2204)
net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
com.dqian.manager.UserManager.register(UserManager.java:87)
org.apache.jsp.user.regok_jsp._jspService(regok_jsp.java:50)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305)
Name and version of the database you are using:oracle of 9.2.0.4
I used HibernateSynchronizer(HS) to generate mapping file automaticly.
As used the method the HS wrapped, the above exception occured, and then, I went to the original hibernate way(code as shown above), the exception occured again.
Any idea?
|