休眠异常:批量更新返回来自update [0]的意外行计数;实际行数:0;预计:1 [英] hibernate exception: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

查看:89
本文介绍了休眠异常:批量更新返回来自update [0]的意外行计数;实际行数:0;预计:1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我试图将预订保存到数据库时,我得到了 StaleStateException 。在我的情况下,我有一个预订实体,bookingNo是主键,而不是自动增量。所以我的逻辑是:


  1. 生成预订号并将其设置为预订。


  2. 呼叫 session.save()



$ b $顺便说一句,我使用的是hibernate3 + spring + MySql5.5并在tomcat6中运行它,更多细节请看我的编码和日志:

预订实体

  @Entity 
@Table(name =booking)
public class Booking extends BaseModel (
$ b public Booking(){
}
@Id
@Column(length = 50)
private String bookingNo;
@Column(length = 50,nullable = false)
private String bookedBy;
@Column(length = 1,nullable = false)
私有字符串状态;
@Column(nullable = false)
私人日期createDate;
@Column(nullable = false)
私人日期bookingDate;

预订DAO储存功能

  @Override 
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
public Object save(Object object){
logger.debug(save ()开始,将预订[+ object +]保存到DB);
预订预订=(预订)对象;
String bookingNo;
//第一步:检查预订号是否为空,如果为空,则由客户首先生成预订号
if(booking.getBookingNo()== null || booking.getBookingNo()。trim() .isEmpty()){
logger.debug(save(),查找预订号为空,将不会生成预订);
bookingNo =(String)generateBookingNo(booking.getCustomer());
//设置生成的预订no以预订
booking.setBookingNo(bookingNo);
}
//第2步:获取休眠会话
会话会话= sf.getCurrentSession();
logger.debug(保存(),获取会话并开始保存预订);
//第3步:保存预订
session.save(booking);
logger.debug(保存预订后,预订为[+ booking +]);
退回预订;






当我的struts2动作调用save函数来保存预订时,它会得到以下错误:

  13:23:32,703错误AbstractBatcher:51  - 执行批处理的异常:
org.hibernate .StaleStateException:批量更新从update [0]返回意外的行数;实际行数:0;预期:1
在org.hibernate.jdbc.Expectations $ BasicExpectation.checkBatched(Expectations.java:61)
at org.hibernate.jdbc.Expectations $ BasicExpectation.verifyOutcome(Expectations.java:46)
。在org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
处org.hibernate作为org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
。在org.hibernate.engine.ActionQueue.executeActions jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
(ActionQueue.java:235)
在org.hibernate.engine.ActionQueue.executeActions(ActionQueue。 Java的:143)
在org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
在org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.ja va:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)$ b在org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
$ b在org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
。在组织.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
在org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
在org.springframework.aop .framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.Cglib2AopProxy $ DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.j ava:621)
at com.chailie.booking.dao.impl.booking.BookingDAO $$ EnhancerByCGLIB $$ abf7a248.save(< generated>)
at com.chailie.booking.control.BookingAction .save(BookingAction.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(本地方法)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun .reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
在java.lang.reflect.Method.invoke(Method.java:601)在com.opensymphony.xwork2.DefaultActionInvocation.invokeAction
(DefaultActionInvocation的.java:452)在com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291

在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
在com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
在com.opensymphony.xwor k2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
处com.opensymphony.xwork2.validator.ValidationInterceptor com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
。 doIntercept(ValidationInterceptor.java:263)
在org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
在com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept( MethodFilterInterceptor.java:98)美元,com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248 b $ b)
在com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
at c om.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
处com.opensymphony.xwork2 com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
。 interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
在com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
在com.opensymphony.xwork2.DefaultActionInvocation.invoke( DefaultActionInvocation.java:248)美元,com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190 b $ b)
在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org .apache.struts2.in terceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept( FileUploadInterceptor.java:243)在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248

在com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)

在com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
。在COM .opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:270)
at com.opensymphony.xwork2 .DefaultActionInvocation.invok e(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:在com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171 248)

。在com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
at com.opensymphony .xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
在org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
在com.opensymphony.xwork2.DefaultActionInvocation.invoke (DefaultActionInvocation.java:248)
at com。 opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
处com.opensymphony.xwork2.interceptor com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
。 ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
在com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
在com.chailie.booking.interceptor.InitToDoItemInterceptor.doIntercept(InitToDoItemInterceptor。 java:51)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498)
at org .apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(Execu teOperations.java:77)
在org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter( ApplicationFilterChain.java:235)
在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191 233)

。在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)$ b在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
$ b在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
。在组织.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 859)
at org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint $ Worker.run(JIoEndpoint。 java:489)
at java.lang.Thread.run(Thread.java:722)



<当代理尝试在保存函数结束时提交事务时,似乎会发生此错误,但我不知道导致此问题的原因是什么,有人能告诉我为什么我会遇到此问题吗?
Ps:如果您需要更多的编码或日志,请让我知道,我会根据您的要求发布它。


更多hibernate登录调试级别 $>

  22:46:55,768 DEBUG AbstractBatcher:358  - 即将打开PreparedStatement(打开PreparedStatements:0,全局:0)
22:46:55,768 DEBUG AbstractBatcher:358 - 即将打开PreparedStatement(打开PreparedStatements:0,全局为0)
22:46:55,769 DEBUG SQL:393 - 插入到dpac_todoitem(assignedBy,assignedDate,assignedTo,bookingNo, cancelledBy,cancelledDate,completedBy,completedDate,createDate,serviceCode,serviceDesc,status,timestamp,actDeliveredPkg,actDeliveredTime,actDispatchedTime,estDeliveredTime,sequence)值(?,?,?,?,?,? DEBUG SQL:393 - 插入到dpac_todoitem(assignedBy,assignedDate,assignedTo,bookingNo,cancelledBy,cancelledDate,completedBy,completedDate,...)中, createDate,serviceCode,serviceDesc,status,tim (,,est,,,,,,,,,,,,,,,,,,,,,,,,,,,est,est est est est est est est est est est est est est est est est est est est est est est est est est est est)
22:46:55,770 DEBUG AbstractBatcher:476 - 准备报表
22:46:55,770调试AbstractBatcher:476 - 准备报表
22:46:55,771调试AbstractEntityPersister:1942 - 脱水实体: com.chailie.booking.model.todo.DPAC#425988]
22:46:55,771 DEBUG AbstractEntityPersister:1942 - 脱水实体:[com.chailie.booking.model.todo.DPAC#425988]
22:46:55,772 DEBUG StringType:80 - 将chailieyang绑定到参数:1
22:46:55,772 DEBUG StringType:80 - 将chailieyang绑定到参数:1
22:46:55,773 DEBUG TimestampType:80 - 将'2013-04-29 00:00:00'绑定到参数:2
22:46:55,773 DEBUG TimestampType:80 - 绑定'2013-04-29 00:00:00'to parameter :2
22:46:55,774 DEBUG StringType:80 - 将'chailieyang'绑定到参数:3
22:46:55,774 DEBUG StringType:80 - bind 'chailieyang'参数:3
22:46:55,775 DEBUG StringType:73 - 将null绑定到参数:4
22:46:55,775 DEBUG StringType:73 - 将null绑定到参数:4
22:46:55,775 DEBUG StringType:80 - 绑定参数:'5
22:46:55,775 DEBUG StringType:80 - 绑定''参数:5
22:46:55,778 DEBUG时间戳类型:73 - 将null绑定到参数:6
22:46:55,778 DEBUG TimestampType:73 - 将null绑定到参数:6
22:46:55,778 DEBUG StringType:80 - 绑定参数: 7
22:46:55,778 DEBUG StringType:80 - 绑定参数:'7
22:46:55,779 DEBUG TimestampType:73 - 将null绑定到参数:8
22:46: 55,779调试时间戳类型:73 - 将null绑定到参数:8
22:46:55,780 DEBUG TimestampType:73 - 将null绑定到参数:9
22:46:55,780 DEBUG TimestampType:73 - :9
22:46:55,780 DEBUG StringType:80 - 将'DPAC'绑定到参数:10
22:46:55,780 DEBUG StringTy pe:80 - 将'DPAC'绑定到参数:10
22:46:55,781 DEBUG StringType:80 - 将'DPAC'绑定到参数:11
22:46:55,781 DEBUG StringType:80 - binding' DPAC'参数:11
22:46:55,781 DEBUG StringType:80 - 绑定'PENDING'参数:12
22:46:55,781 DEBUG字符串类型:80 - 绑定'PENDING'参数:12
22:46:55,782 DEBUG TimestampType:80 - binding'2013-04-29 22:46:55'to parameter:13
22:46:55,782 DEBUG TimestampType:80 - binding'2013-04 -29 22:46:55'to参数:13
22:46:55,783 DEBUG IntegerType:73 - 将null绑定到参数:14
22:46:55,783 DEBUG IntegerType:73 - 将null绑定到参数:14
22:46:55,784 DEBUG TimestampType:73 - 将null绑定到参数:15
22:46:55,784 DEBUG TimestampType:73 - 将null绑定到参数:15
22:46: 55,784调试时间戳类型:73 - 将null绑定到参数:16
22:46:55,784 DEBUG TimestampType:73 - 将null绑定到参数:16
22:46:55,785 DEBUG时间戳类型:73 - 将null绑定到参数:17
22:46:55,785 DEBUG TimestampType:73 - 将null绑定到参数:17
22:46:55,785 DEBUG IntegerType:80 - 绑定'425988' :18
22:46:55,785 DEBUG IntegerType:80 - 绑定'425988'至参数:18
22:46:55,786 DEBUG AbstractBatcher:44 - 执行批量大小:1
22:46 :55,786 DEBUG AbstractBatcher:44 - 执行批量大小:1
22:46:55,787 DEBUG AbstractBatcher:366 - 即将关闭PreparedStatement(打开PreparedStatements:1,全局:1)
22:46:55,787 DEBUG AbstractBatcher:366 - 即将关闭PreparedStatement(打开PreparedStatements:1,全局:1)
22:46:55,788调试AbstractBatcher:525 - 关闭语句
22:46:55,788调试AbstractBatcher:525 - 关闭语句
22:46:55,789 DEBUG AbstractCollectionPersister:1090 - 插入集合:[com.chailie.booking.model.booking.Booking.parts#SAMSUNG-100003]
22:46:55,789 DEBUG AbstractCollectionPersister:1090 - Inserti ng collection:[com.chailie.booking.model.booking.Booking.parts#SAMSUNG-100003]
22:46:55,790 DEBUG AbstractBatcher:358 - 即将打开PreparedStatement(打开PreparedStatements:0,全局为0)
22:46:55,790 DEBUG AbstractBatcher:358 - 即将打开PreparedStatement(打开PreparedStatements:0,全局:0)
22:46:55,791 DEBUG SQL:393 - 更新零件集bookingNo =? where sequence =?
22:46:55,791 DEBUG SQL:393 - 更新零件集bookingNo =? where sequence =?
22:46:55,791 DEBUG AbstractBatcher:476 - 准备语句
22:46:55,791 DEBUG AbstractBatcher:476 - 准备语句
22:46:55,793调试字符串类型:80 - 绑定'SAMSUNG- 100003'参数:1
22:46:55,793 DEBUG StringType:80 - 绑定'SAMSUNG-100003'为参数:1
22:46:55,794 DEBUG IntegerType:80 - 绑定参数'8' :2
22:46:55,794 DEBUG IntegerType:80 - 绑定'8'到参数:2
22:46:55,794 DEBUG AbstractCollectionPersister:1172 - 完成插入集合:插入1行
22 :46:55794 DEBUG AbstractCollectionPersister:1172 - 完成插入系列:1行插入
22:46:55795 DEBUG AbstractCollectionPersister:1090 - 插入集合:[com.chailie.booking.model.booking.Booking.toDoItems#SAMSUNG- 100003]
22:46:55,795 DEBUG AbstractCollectionPersister:1090 - 插入集合:[com.chailie.booking.model.booking.Booking.toDoItems#SAMSUNG-100003]
22:46:55,796 DEBUG AbstractBatcher: 44 - Exe剪切批量大小:1
22:46:55,796 DEBUG AbstractBatcher:44 - 执行批量大小:1
22:46:55,797调试AbstractBatcher:366 - 即将关闭PreparedStatement(打开PreparedStatements:1,全局: 1)
22:46:55,797调试AbstractBatcher:366 - 即将关闭PreparedStatement(打开PreparedStatements:1,全局:1)
22:46:55,798 DEBUG AbstractBatcher:525 - 结束语句
22:46:55,798 DEBUG AbstractBatcher:525 - 关闭语句
22:46:55,799调试AbstractBatcher:358 - 即将打开PreparedStatement(打开PreparedStatements:0,全局:0)
22:46:55,799 DEBUG AbstractBatcher:358 - 即将打开PreparedStatement(打开PreparedStatements:0,全局为0)
22:46:55,800 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,800 DEBUG SQL:393 - 更新todoitem set bookingNo =? where sequence =?
22:46:55,800 DEBUG AbstractBatcher:476 - 准备语句
22:46:55,800 DEBUG AbstractBatcher:476 - 准备语句
22:46:55,801 DEBUG StringType:80 - binding'SAMSUNG- 100003'参数:1
22:46:55,801 DEBUG StringType:80 - 绑定'SAMSUNG-100003'为参数:1
22:46:55,802 DEBUG IntegerType:80 - 绑定'425984'为参数:2
22:46:55,802 DEBUG IntegerType:80 - binding'425984'to parameter:2
22:46:55,803 DEBUG AbstractBatcher:222 - 重复使用预处理语句
22:46:55,803 DEBUG AbstractBatcher:222 - 重用预准备语句
22:46:55,803 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,803 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,804 DEBUG StringType:80 - 将'SAMSUNG-100003'绑定到参数:1
22:46:55,804 DEBUG StringType:80 - 将'SAMSUNG-100003'绑定到参数:1
22:46:55,805 DEBUG IntegerType:80 - binding'425985'to parameter:2
22:46:55,805 DEBUG IntegerType:80 - binding'425985'to parameter:2
22:46: 55,805 DEBUG AbstractBatcher:222 - 重复使用准备好的语句
22:46:55,805 DEBUG AbstractBatcher:222 - 重用预准备语句
22:46:55,806 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,806 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,807 DEBUG StringType:80 - 将'SAMSUNG-100003'绑定到参数:1
22:46:55,807 DEBUG StringType:80 - 将'SAMSUNG-100003'绑定到参数:1
22:46:55,807 DEBUG IntegerType:80 - binding'425986'to parameter:2
22:46:55,807 DEBUG IntegerType:80 - binding'425986'to parameter:2
22:46: 55,808 DEBUG AbstractBatcher:222 - 重用预准备语句
22:46:55,808 DEBUG AbstractBatcher:222 - 重用预准备语句
22:46:55,808 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,808 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,809 DEBUG StringType:80 - 将'SAMSUNG-100003'绑定到参数:1
22:46:55,809 DEBUG StringType:80 - 将'SAMSUNG-100003'绑定到参数:1 $ b DEBUG IntegerType:80 - binding'425987'to parameter:2
22:46:55,810 DEBUG IntegerType:80 - binding'425987'to parameter:2
22:46: 55,810 DEBUG AbstractBatcher:222 - 重用预准备语句
22:46:55,810 DEBUG AbstractBatcher:222 - 重用预准备语句
22:46:55,811 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,811 DEBUG SQL:393 - 更新todoitem集合bookingNo =? where sequence =?
22:46:55,812 DEBUG StringType:80 - 将'SAMSUNG-100003'绑定到参数:1
22:46:55,812 DEBUG StringType:80 - 将'SAMSUNG-100003'绑定到参数:1
22:46:55,812 DEBUG IntegerType:80 - binding'425988'to parameter:2
22:46:55,812 DEBUG IntegerType:80 - binding'425988'to parameter:2
22:46: 55813 DEBUG AbstractCollectionPersister:1172 - 完成插入集合:插入5行
22:46:55,813 DEBUG AbstractCollectionPersister:1172 - 完成插入集合:插入5行
22:46:55,814 DEBUG AbstractBatcher:44 - 执行批处理大小:5
22:46:55,814 DEBUG AbstractBatcher:44 - 执行批量大小:5
22:46:55,817错误AbstractBatcher:51 - 执行批次的异常:
org.hibernate.StaleStateException:批量更新从update [0]返回了意外的行数;实际行数:0;预计:1


解决方案

while todoitem inheritance strategy to JOINED as以下,然后问题消失

  @Entity 
@Table(name =todoitem)
@Inheritance (strategy = InheritanceType.JOINED)
public class ToDoItem extends BaseModel {


When I tried to save booking to DB, I got StaleStateException. In my case,i have a booking entity, bookingNo is primary key while it is not auto increment. So my logic is:

  1. Generate booking no and set it to booking.

  2. Call session.save().

By the way,I am using hibernate3 + spring + MySql5.5 and run it in tomcat6,For more detail,please see my coding and log:

Booking Entity

@Entity
@Table(name="booking")
public class Booking extends BaseModel{

    public Booking(){
    }
    @Id
    @Column(length=50)
    private String bookingNo;
    @Column(length=50,nullable=false)
    private String bookedBy;
    @Column(length=1,nullable=false)
    private String status;
    @Column(nullable=false)
    private Date createDate;
    @Column(nullable=false)
    private Date bookingDate;

Booking DAO save function

@Override
    @Transactional(propagation=Propagation.REQUIRED,isolation=Isolation.DEFAULT)
    public Object save(Object object) {
        logger.debug("save() start,save booking["+object+"] to DB");
        Booking booking = (Booking)object;
        String bookingNo;
        //Step 1:Check if booking no is empty,if empty,generate booking no by customer first
        if(booking.getBookingNo() == null || booking.getBookingNo().trim().isEmpty()){
            logger.debug("save(),find booking no is empty,will generate booking no first");
                bookingNo = (String) generateBookingNo(booking.getCustomer());
                //Set generated booking no to booking
                booking.setBookingNo(bookingNo);
        }
        //Step 2:Get hibernate session
        Session session = sf.getCurrentSession();
        logger.debug("save(),get session and start save booking");
        //Step 3:Save booking
         session.save(booking);
        logger.debug("After save booking,the booking is ["+booking+"]");
        return booking;

}

When my struts2 action invoke the save function to save booking,it will got following error

13:23:32,703 ERROR AbstractBatcher:51 - Exception executing batch: 
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
    at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
    at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
    at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:143)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
    at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
    at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
    at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:621)
    at com.chailie.booking.dao.impl.booking.BookingDAO$$EnhancerByCGLIB$$abf7a248.save(<generated>)
    at com.chailie.booking.control.BookingAction.save(BookingAction.java:100)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
    at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
    at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:263)
    at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:133)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:207)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:270)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:190)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at com.chailie.booking.interceptor.InitToDoItemInterceptor.doIntercept(InitToDoItemInterceptor.java:51)
    at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
    at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:248)
    at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
    at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:498)
    at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:722)

Seems occur this error when proxy tried to commit transaction in the end of save function,but i don't know what lead to this problem,does anyone could tell me why i will have this issue? Ps:If you need more coding or log,please let me know,i will post it according to your requirement

More hibernate log in debug level

22:46:55,768 DEBUG AbstractBatcher:358 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
22:46:55,768 DEBUG AbstractBatcher:358 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
22:46:55,769 DEBUG SQL:393 - insert into dpac_todoitem (assignedBy, assignedDate, assignedTo, bookingNo, cancelledBy, cancelledDate, completedBy, completedDate, createDate, serviceCode, serviceDesc, status, timestamp, actDeliveredPkg, actDeliveredTime, actDispatchedTime, estDeliveredTime, sequence) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
22:46:55,769 DEBUG SQL:393 - insert into dpac_todoitem (assignedBy, assignedDate, assignedTo, bookingNo, cancelledBy, cancelledDate, completedBy, completedDate, createDate, serviceCode, serviceDesc, status, timestamp, actDeliveredPkg, actDeliveredTime, actDispatchedTime, estDeliveredTime, sequence) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
22:46:55,770 DEBUG AbstractBatcher:476 - preparing statement
22:46:55,770 DEBUG AbstractBatcher:476 - preparing statement
22:46:55,771 DEBUG AbstractEntityPersister:1942 - Dehydrating entity: [com.chailie.booking.model.todo.DPAC#425988]
22:46:55,771 DEBUG AbstractEntityPersister:1942 - Dehydrating entity: [com.chailie.booking.model.todo.DPAC#425988]
22:46:55,772 DEBUG StringType:80 - binding 'chailieyang' to parameter: 1
22:46:55,772 DEBUG StringType:80 - binding 'chailieyang' to parameter: 1
22:46:55,773 DEBUG TimestampType:80 - binding '2013-04-29 00:00:00' to parameter: 2
22:46:55,773 DEBUG TimestampType:80 - binding '2013-04-29 00:00:00' to parameter: 2
22:46:55,774 DEBUG StringType:80 - binding 'chailieyang' to parameter: 3
22:46:55,774 DEBUG StringType:80 - binding 'chailieyang' to parameter: 3
22:46:55,775 DEBUG StringType:73 - binding null to parameter: 4
22:46:55,775 DEBUG StringType:73 - binding null to parameter: 4
22:46:55,775 DEBUG StringType:80 - binding '' to parameter: 5
22:46:55,775 DEBUG StringType:80 - binding '' to parameter: 5
22:46:55,778 DEBUG TimestampType:73 - binding null to parameter: 6
22:46:55,778 DEBUG TimestampType:73 - binding null to parameter: 6
22:46:55,778 DEBUG StringType:80 - binding '' to parameter: 7
22:46:55,778 DEBUG StringType:80 - binding '' to parameter: 7
22:46:55,779 DEBUG TimestampType:73 - binding null to parameter: 8
22:46:55,779 DEBUG TimestampType:73 - binding null to parameter: 8
22:46:55,780 DEBUG TimestampType:73 - binding null to parameter: 9
22:46:55,780 DEBUG TimestampType:73 - binding null to parameter: 9
22:46:55,780 DEBUG StringType:80 - binding 'DPAC' to parameter: 10
22:46:55,780 DEBUG StringType:80 - binding 'DPAC' to parameter: 10
22:46:55,781 DEBUG StringType:80 - binding 'DPAC' to parameter: 11
22:46:55,781 DEBUG StringType:80 - binding 'DPAC' to parameter: 11
22:46:55,781 DEBUG StringType:80 - binding 'PENDING' to parameter: 12
22:46:55,781 DEBUG StringType:80 - binding 'PENDING' to parameter: 12
22:46:55,782 DEBUG TimestampType:80 - binding '2013-04-29 22:46:55' to parameter: 13
22:46:55,782 DEBUG TimestampType:80 - binding '2013-04-29 22:46:55' to parameter: 13
22:46:55,783 DEBUG IntegerType:73 - binding null to parameter: 14
22:46:55,783 DEBUG IntegerType:73 - binding null to parameter: 14
22:46:55,784 DEBUG TimestampType:73 - binding null to parameter: 15
22:46:55,784 DEBUG TimestampType:73 - binding null to parameter: 15
22:46:55,784 DEBUG TimestampType:73 - binding null to parameter: 16
22:46:55,784 DEBUG TimestampType:73 - binding null to parameter: 16
22:46:55,785 DEBUG TimestampType:73 - binding null to parameter: 17
22:46:55,785 DEBUG TimestampType:73 - binding null to parameter: 17
22:46:55,785 DEBUG IntegerType:80 - binding '425988' to parameter: 18
22:46:55,785 DEBUG IntegerType:80 - binding '425988' to parameter: 18
22:46:55,786 DEBUG AbstractBatcher:44 - Executing batch size: 1
22:46:55,786 DEBUG AbstractBatcher:44 - Executing batch size: 1
22:46:55,787 DEBUG AbstractBatcher:366 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
22:46:55,787 DEBUG AbstractBatcher:366 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
22:46:55,788 DEBUG AbstractBatcher:525 - closing statement
22:46:55,788 DEBUG AbstractBatcher:525 - closing statement
22:46:55,789 DEBUG AbstractCollectionPersister:1090 - Inserting collection: [com.chailie.booking.model.booking.Booking.parts#SAMSUNG-100003]
22:46:55,789 DEBUG AbstractCollectionPersister:1090 - Inserting collection: [com.chailie.booking.model.booking.Booking.parts#SAMSUNG-100003]
22:46:55,790 DEBUG AbstractBatcher:358 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
22:46:55,790 DEBUG AbstractBatcher:358 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
22:46:55,791 DEBUG SQL:393 - update part set bookingNo=? where sequence=?
22:46:55,791 DEBUG SQL:393 - update part set bookingNo=? where sequence=?
22:46:55,791 DEBUG AbstractBatcher:476 - preparing statement
22:46:55,791 DEBUG AbstractBatcher:476 - preparing statement
22:46:55,793 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,793 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,794 DEBUG IntegerType:80 - binding '8' to parameter: 2
22:46:55,794 DEBUG IntegerType:80 - binding '8' to parameter: 2
22:46:55,794 DEBUG AbstractCollectionPersister:1172 - done inserting collection: 1 rows inserted
22:46:55,794 DEBUG AbstractCollectionPersister:1172 - done inserting collection: 1 rows inserted
22:46:55,795 DEBUG AbstractCollectionPersister:1090 - Inserting collection: [com.chailie.booking.model.booking.Booking.toDoItems#SAMSUNG-100003]
22:46:55,795 DEBUG AbstractCollectionPersister:1090 - Inserting collection: [com.chailie.booking.model.booking.Booking.toDoItems#SAMSUNG-100003]
22:46:55,796 DEBUG AbstractBatcher:44 - Executing batch size: 1
22:46:55,796 DEBUG AbstractBatcher:44 - Executing batch size: 1
22:46:55,797 DEBUG AbstractBatcher:366 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
22:46:55,797 DEBUG AbstractBatcher:366 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
22:46:55,798 DEBUG AbstractBatcher:525 - closing statement
22:46:55,798 DEBUG AbstractBatcher:525 - closing statement
22:46:55,799 DEBUG AbstractBatcher:358 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
22:46:55,799 DEBUG AbstractBatcher:358 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
22:46:55,800 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,800 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,800 DEBUG AbstractBatcher:476 - preparing statement
22:46:55,800 DEBUG AbstractBatcher:476 - preparing statement
22:46:55,801 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,801 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,802 DEBUG IntegerType:80 - binding '425984' to parameter: 2
22:46:55,802 DEBUG IntegerType:80 - binding '425984' to parameter: 2
22:46:55,803 DEBUG AbstractBatcher:222 - reusing prepared statement
22:46:55,803 DEBUG AbstractBatcher:222 - reusing prepared statement
22:46:55,803 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,803 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,804 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,804 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,805 DEBUG IntegerType:80 - binding '425985' to parameter: 2
22:46:55,805 DEBUG IntegerType:80 - binding '425985' to parameter: 2
22:46:55,805 DEBUG AbstractBatcher:222 - reusing prepared statement
22:46:55,805 DEBUG AbstractBatcher:222 - reusing prepared statement
22:46:55,806 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,806 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,807 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,807 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,807 DEBUG IntegerType:80 - binding '425986' to parameter: 2
22:46:55,807 DEBUG IntegerType:80 - binding '425986' to parameter: 2
22:46:55,808 DEBUG AbstractBatcher:222 - reusing prepared statement
22:46:55,808 DEBUG AbstractBatcher:222 - reusing prepared statement
22:46:55,808 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,808 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,809 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,809 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,810 DEBUG IntegerType:80 - binding '425987' to parameter: 2
22:46:55,810 DEBUG IntegerType:80 - binding '425987' to parameter: 2
22:46:55,810 DEBUG AbstractBatcher:222 - reusing prepared statement
22:46:55,810 DEBUG AbstractBatcher:222 - reusing prepared statement
22:46:55,811 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,811 DEBUG SQL:393 - update todoitem set bookingNo=? where sequence=?
22:46:55,812 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,812 DEBUG StringType:80 - binding 'SAMSUNG-100003' to parameter: 1
22:46:55,812 DEBUG IntegerType:80 - binding '425988' to parameter: 2
22:46:55,812 DEBUG IntegerType:80 - binding '425988' to parameter: 2
22:46:55,813 DEBUG AbstractCollectionPersister:1172 - done inserting collection: 5 rows inserted
22:46:55,813 DEBUG AbstractCollectionPersister:1172 - done inserting collection: 5 rows inserted
22:46:55,814 DEBUG AbstractBatcher:44 - Executing batch size: 5
22:46:55,814 DEBUG AbstractBatcher:44 - Executing batch size: 5
22:46:55,817 ERROR AbstractBatcher:51 - Exception executing batch: 
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

解决方案

While change todoitem inheritance strategy to JOINED as following,then problem gone

@Entity
@Table(name="todoitem")
@Inheritance(strategy=InheritanceType.JOINED)
public class ToDoItem extends BaseModel{

这篇关于休眠异常:批量更新返回来自update [0]的意外行计数;实际行数:0;预计:1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆