type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: Could not execute JDBC batch update
cn.hxex.vote.filter.HibernateFilter.doFilter(HibernateFilter.java:75)
root cause org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
cn.hxex.vote.filter.HibernateFilter.doFilter(HibernateFilter.java:57)请问这是哪里出的错啊 是不是数据设置有问题 只有删除操作会出此错 对查询 修改 添加都没有问题 求各位大侠帮忙啊...在线等
cn.hxex.vote.filter.HibernateFilter.doFilter(HibernateFilter.java:75)
root cause org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:356)
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
cn.hxex.vote.filter.HibernateFilter.doFilter(HibernateFilter.java:57)请问这是哪里出的错啊 是不是数据设置有问题 只有删除操作会出此错 对查询 修改 添加都没有问题 求各位大侠帮忙啊...在线等
解决方案 »
- 如何获取当前5天时间时间和星期
- 关于hibernate分组统计null值的不统计
- iframe中的页面不显示
- http post 方法传递form 和文件,接受方需要怎样获取.
- 大型网站的网页技术?
- 关于javaBean错误!~请指教
- jsp里面如何取得网站的域名地址?
- 严重: Servlet.service() for servlet [jsp] in context with path [] threw exception
- 采用window.open后的页面,为什么SEESION无法传递到页面上?
- 请教:webapps\ROOT下有一目录test
- 100分急求!在线等!!!高手进!!!!!!!!!!!!!!!!!!!!!!!!!!!
- jasper打印预览的问题。
不能执行jdbc的级联更新
是不是你删除的这张表和别的表有级联关系,结果你删除这张表时会级联删除另外表的记录
可能时另外的记录正在使用
如果没有的话就检查一下你的.hbm.xml中关于级联那部分代码
下面是两个表的级联 请帮看一下吧
Vote.hbm.xml
------------
<class name="Vote" table="VOTE">
<id name="id" column="ID" type="string">
<generator class="uuid.hex"/>
</id>
<property name="name" column="NAME"/>
<property name="title" column="TITLE" />
<property name="votetype" column="VOTETYPE" /> <property name="pictype" column="PICTYPE" /> <set name="voteitems" cascade="all" order-by="title asc">
<key column="VOTE_ID"/>
<one-to-many class="VoteItem"/>
</set>
</class>
==================================================
VoteItem.hbm.xml
----------------
<class name="VoteItem" table="VOTEITEM">
<id name="id" column="ID" type="string">
<generator class="uuid.hex"/>
</id>
<property name="title" column="TITLE"/>
<property name="votenum" column="VOTENUM" />
<many-to-one name="vote" column="VOTE_ID"/>
</class>
id varchar(32) not null,
name varchar(40) not null,
title varchar(120) not null,
votetype varchar(24),
pictype varchar(24),
constraint vote_pk primary key (id),
constraint vote_unique_name unique (name));create table voteitem(
id varchar(32) not null,
title varchar(64) not null,
votenum varchar(32),
vote_id varchar(32) not null,
constraint voteitem_pk primary key (id),
constraint voteitem_vote foreign key (vote_id) references vote (id));上面上两个表的sql脚本 看看是不是这里有错啊
配置我大致看了一下,也没有什么问题
对了
在各自的类文件中设置set和Vote没有
还有,最好把删除是生成的sql也发一下
类中对每个属性都设置了setXXX和getXXX方法 我用的是hibernate来存储数据的 数据是以对象的形式传给hibernate由hibernate跟根映射文件自动在数据对象和表中数据之间的转换地.子类:public void deleteVote(Vote vote) 子类:public void deleteVoteItem(VoteItem voteitem)
{ {
super.deleteObject( vote ); super.deleteObject( voteitem );
} }
↓调用 ↓调用
父类:public void deleteObject( Object obj ) ←———————————
{
getSession().delete( obj );
}
上面是一个子类的两个删除不同数据对象的方法 这两个方法都调用父类的deleteObject( Object obj )方法来执行删除操作 getSession().delete( obj );这个是就hibernate提供的持久化方法了 这里不会有什么问题吧hornbilltofy
你说"设计时使用外键会给你后带来很多麻烦."如果不使用外键的话那么删除被参照表里的数据时参照此数据的别一个表里的数据就会成为没有用的数据而长期存在数据库中了 这样怎么办啊
<key column="VOTE_ID"/>
<one-to-many class="VoteItem"/>
</set> 这个Set应该是inverse="true".
你两个试试吧.只能由一端来管理.