[dtss] 2012-03-15 12:30:58,515 ERROR [btpool0-3] org.hibernate.AssertionFailure.<init>-22 | an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
org.hibernate.AssertionFailure: collection [gov.sdta.dtss.domain.info.destination.Destination.distCenterList] was not processed by flush()
at org.hibernate.engine.CollectionEntry.postFlush(CollectionEntry.java:205)
at org.hibernate.event.def.AbstractFlushingEventListener.postFlush(AbstractFlushingEventListener.java:333)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:28)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1001)
at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:304)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:358)
at $Proxy68.flush(Unknown Source)
at org.springframework.orm.jpa.JpaTemplate$8.doInJpa(JpaTemplate.java:295)
at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:184)
at org.springframework.orm.jpa.JpaTemplate.flush(JpaTemplate.java:293)
在程序中打上断点无法跟踪到错误源头,希望各位大虾帮帮忙,不胜感激!!!

解决方案 »

  1.   

    this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session怀疑你session的用法不对,你是怎么用的flush方法?
      

  2.   

    我改的是别人之前写的程序,在return之前调用flush()方法pictureRepository.getDbRepository().getJpaTemplate().flush();
      

  3.   

    lilijun0525       你没看到我刚注册的账号吗?!!!
      

  4.   

    我顶,我 的 也是这个问题,不过我的原因是因为我表里面有个字段是唯一键,所以我插入相同的时候才会报错,但让我最奇怪的地方是使用mysql navicate查看的时候,我发现太TMD奇特了:
    比如我用hibernate插入这个唯一键的值是"sky",然后插入"sky",最后插入"sky1",我发现了神奇的事情就是
    id  name
    1   sky
    3   sky1
    我发现自增长的id少了个2,然后报错和楼主一样,难道是SSH整合出问题?