2

当我尝试将预订保存到 DB 时,我得到了StaleStateException. 就我而言,我有一个预订实体,bookingNo 是主键,而不是自动增量。所以我的逻辑是:

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

  2. 打电话session.save()

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

预订实体

@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 操作调用 save 函数保存预订时,会出现以下错误

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
4

1 回答 1

1

将 todoitem 继承策略更改为 JOINED 如下,然后问题就消失了

@Entity
@Table(name="todoitem")
@Inheritance(strategy=InheritanceType.JOINED)
public class ToDoItem extends BaseModel{
于 2013-05-04T03:45:27.763 回答