2013-04-29 2 views
2

Когда я попытался сохранить бронирование в БД, я получил StaleStateException. В моем случае у меня есть объект бронирования, bookingNo является основным ключом, в то время как он не увеличивается автоматически. Таким образом, моя логика такова:исключение для спящего режима: пакетное обновление возвращает неожиданный счетчик строк из обновления [0]; фактическое количество строк: 0; Ожидается: 1

  1. Создайте заказной номер и установите его для бронирования.

  2. Звонок session.save().

Кстати, я использую hibernate3 + пружины + MySql5.5 и запустить его в tomcat6, Более подробно смотрите мою кодировку и войти:

Бронирование 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; 

бронирование DAO функции сохранения

@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; 

} 

Когда мое struts2 действия вызова функции сохранения, чтобы сохранить номер, он получил следовать ИНГИ ошибка

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) 

Кажется происходит эту ошибку, когда прокси-сервер пытался совершить сделку в конце сохранить функцию, но я не знаю, что привело к этой проблеме, кто-нибудь может сказать мне, почему у меня будет этот вопрос? Ps: Если вам нужно больше кодирования или войти, пожалуйста, дайте мне знать, я буду размещать его в соответствии с вашим требованием

Подробнее журнала зимуют уровня отладки

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 
+0

Почему вы не задаете другие свойства класса бронирования, отмеченные как nullable = false? Только бронирование не установлено. –

+0

В вашем кодексе я не вижу никаких проблем. Не могли бы вы опубликовать журнал выполненного оператора, например, с ' true' в вашем hibernate.cfg? Важно, чтобы фактическое значение для bookingNo, которое вы не видите в этом журнале. Лучше всего использовать инструмент, например 'log4jdbc', чтобы сделать параметры видимыми. В качестве замены вы можете распечатать «bookingNo» в своем коде. Существует ли какая-либо строка базы данных для этого идентификатора? (Do 'SELECT * FROM booking WHERE bookingNo = ...' в SQL.) – Johanna

+0

Плохая новость, запись более 30 тыс. Символов, поэтому я могу просто опубликовать их часть, пожалуйста, см. Ее, спасибо – Chailie

ответ

1

Хотя изменение todoitem стратегии наследования к JOINED следующим , тогда проблема ушла

@Entity 
@Table(name="todoitem") 
@Inheritance(strategy=InheritanceType.JOINED) 
public class ToDoItem extends BaseModel{ 
Смежные вопросы

 Смежные вопросы