﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-大漠驼铃-随笔分类-hibernate</title><link>http://www.blogjava.net/nkjava/category/36592.html</link><description>置身浩瀚的沙漠，方向最为重要，希望此blog能向大漠驼铃一样，给我方向和指引。
EJB/JPA/JSF/Struts/Spring/Hibernate/Perl/Shell/C/Java
</description><language>zh-cn</language><lastBuildDate>Wed, 11 Aug 2010 21:34:12 GMT</lastBuildDate><pubDate>Wed, 11 Aug 2010 21:34:12 GMT</pubDate><ttl>60</ttl><item><title>Row was updated or deleted by another transaction</title><link>http://www.blogjava.net/nkjava/archive/2010/08/11/328555.html</link><dc:creator>草原上的骆驼</dc:creator><author>草原上的骆驼</author><pubDate>Wed, 11 Aug 2010 08:48:00 GMT</pubDate><guid>http://www.blogjava.net/nkjava/archive/2010/08/11/328555.html</guid><wfw:comment>http://www.blogjava.net/nkjava/comments/328555.html</wfw:comment><comments>http://www.blogjava.net/nkjava/archive/2010/08/11/328555.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nkjava/comments/commentRss/328555.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nkjava/services/trackbacks/328555.html</trackback:ping><description><![CDATA[16:35:56,845 ERROR [JPAPrimaryKeyObjectDAO] Failed to update.<br />
javax.persistence.OptimisticLockException<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.ejb.AbstractEntityManagerImpl.wrapStaleStateException(AbstractEntityManagerImpl.java:627)<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:588)<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:244)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.jpa.tx.TransactionScopedEntityManager.merge(TransactionScopedEntityManager.java:193)<br />
&nbsp;&nbsp; &nbsp;at hanvon.ebook.persistence.general.JPAPrimaryKeyObjectDAO.update(JPAPrimaryKeyObjectDAO.java:91)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
&nbsp;&nbsp; &nbsp;at java.lang.reflect.Method.invoke(Method.java:597)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.GeneratedMethodAccessor967.invoke(Unknown Source)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
&nbsp;&nbsp; &nbsp;at java.lang.reflect.Method.invoke(Method.java:597)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_24570304.invoke(InvocationContextInterceptor_z_fillMethod_24570304.java)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_24570304.invoke(InvocationContextInterceptor_z_setup_24570304.java)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:176)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:216)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)<br />
&nbsp;&nbsp; &nbsp;at $Proxy784.update(Unknown Source)<br />
&nbsp;&nbsp; &nbsp;at hanvon.ebook.business.info.impl.InfoManagerBean.updateInfoNoQuestion(InfoManagerBean.java:101)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
&nbsp;&nbsp; &nbsp;at java.lang.reflect.Method.invoke(Method.java:597)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.GeneratedMethodAccessor967.invoke(Unknown Source)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
&nbsp;&nbsp; &nbsp;at java.lang.reflect.Method.invoke(Method.java:597)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_24570304.invoke(InvocationContextInterceptor_z_fillMethod_24570304.java)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_24570304.invoke(InvocationContextInterceptor_z_setup_24570304.java)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.remoting.IsLocalInterceptor.invokeLocal(IsLocalInterceptor.java:85)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:72)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)<br />
&nbsp;&nbsp; &nbsp;at $Proxy1309.invoke(Unknown Source)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)<br />
&nbsp;&nbsp; &nbsp;at $Proxy1246.updateInfoNoQuestion(Unknown Source)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
&nbsp;&nbsp; &nbsp;at java.lang.reflect.Method.invoke(Method.java:597)<br />
&nbsp;&nbsp; &nbsp;at org.springframework.remoting.rmi.RmiClientInterceptorUtils.invokeRemoteMethod(RmiClientInterceptorUtils.java:110)<br />
&nbsp;&nbsp; &nbsp;at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:99)<br />
&nbsp;&nbsp; &nbsp;at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invokeInContext(AbstractRemoteSlsbInvokerInterceptor.java:141)<br />
&nbsp;&nbsp; &nbsp;at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.invoke(AbstractSlsbInvokerInterceptor.java:189)<br />
&nbsp;&nbsp; &nbsp;at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)<br />
&nbsp;&nbsp; &nbsp;at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)<br />
&nbsp;&nbsp; &nbsp;at $Proxy1247.updateInfoNoQuestion(Unknown Source)<br />
&nbsp;&nbsp; &nbsp;at hanvon.ebook.web.info.service.InfoService.updateInfoNoQuestion(InfoService.java:77)<br />
&nbsp;&nbsp; &nbsp;at hanvon.ebook.web.info.action.InfoAction.addOrEditInfo(InfoAction.java:356)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)<br />
&nbsp;&nbsp; &nbsp;at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)<br />
&nbsp;&nbsp; &nbsp;at java.lang.reflect.Method.invoke(Method.java:597)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:441)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:280)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:243)<br />
&nbsp;&nbsp; &nbsp;at hanvon.ebook.web.interceptor.PermissionInterceptor.intercept(PermissionInterceptor.java:34)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at hanvon.ebook.web.interceptor.EbookLogonInterceptor.intercept(EbookLogonInterceptor.java:32)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:165)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:252)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:306)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)<br />
&nbsp;&nbsp; &nbsp;at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)<br />
&nbsp;&nbsp; &nbsp;at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br />
&nbsp;&nbsp; &nbsp;at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)<br />
&nbsp;&nbsp; &nbsp;at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)<br />
&nbsp;&nbsp; &nbsp;at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)<br />
&nbsp;&nbsp; &nbsp;at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)<br />
&nbsp;&nbsp; &nbsp;at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)<br />
&nbsp;&nbsp; &nbsp;at java.lang.Thread.run(Thread.java:619)<br />
Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [hanvon.ebook.persistence.po.Info#123]<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.event.def.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:313)<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:167)<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:81)<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:704)<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:688)<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:692)<br />
&nbsp;&nbsp; &nbsp;at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:235)<br />
&nbsp;&nbsp; &nbsp;... 197 more<br />
<br />
<br />
EJB+hibernate, table has "version"， 在对一条数据进行插入时手动设置了version的值， 没有问题。<br />
但是在对条数据进行更新操作时却报错了：org.hibernate.StaleObjectStateException: Row was updated or deleted
by another transaction (or unsaved-value mapping was incorrect):
<br />
需要在更新的的页面传递version字段同时设计隐藏，&lt;s:hidden name="info.version"&gt;&lt;/s:hidden&gt;<br />
这样就解决了问题。<br />
<img src ="http://www.blogjava.net/nkjava/aggbug/328555.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nkjava/" target="_blank">草原上的骆驼</a> 2010-08-11 16:48 <a href="http://www.blogjava.net/nkjava/archive/2010/08/11/328555.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>hibernate的 fetch lazy inverse cascade</title><link>http://www.blogjava.net/nkjava/archive/2009/03/09/258655.html</link><dc:creator>草原上的骆驼</dc:creator><author>草原上的骆驼</author><pubDate>Mon, 09 Mar 2009 11:41:00 GMT</pubDate><guid>http://www.blogjava.net/nkjava/archive/2009/03/09/258655.html</guid><wfw:comment>http://www.blogjava.net/nkjava/comments/258655.html</wfw:comment><comments>http://www.blogjava.net/nkjava/archive/2009/03/09/258655.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/nkjava/comments/commentRss/258655.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/nkjava/services/trackbacks/258655.html</trackback:ping><description><![CDATA[<div style="text-align: center;">1.fetch 和 lazy 主要用于级联查询(select) 而 inverse和cascade主要用于级联增、加删、除修改(sava-update,delete)
<br />
2.想要删除父表中的记录,但希望子表中记录的外键引用值设为null的情况：
<br />
&nbsp;&nbsp; 父表的映射文件应该如下配置：
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;set name="emps" inverse="false" cascade="all"&gt;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;key&gt;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="DEPTNO" precision="2" scale="0" /&gt;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/key&gt;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;one-to-many class="com.sino.hibernate.Emp" /&gt;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/set&gt;
<br />
&nbsp;&nbsp;&nbsp; inverse="false"是必须的，cascade可有可无，并且子表的映射文件中inverse没必要设置，cascade也可以不设置，如果设置就设置成为cascade="none"或者cascade="sava-update"
<br />
&lt;many-to-one name="dept" class="com.sino.hibernate.Dept" fetch="select" cascade="save-update"&gt;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;column name="DEPTNO" precision="2" scale="0" /&gt;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/many-to-one&gt;</div>
<br />
<br />
3.关于级联查找
<br />
&nbsp; 对子表的持久化类进行查找的时候，会一起把子表持久化类中的父表持久化类的对象一起查询出来，在页面中可以直接取值的情况：
<br />
&nbsp;&nbsp;&nbsp; 要把父表的映射文件中设置 lazy 属性如下：
<br />
&lt;class name="com.sino.hibernate.Emp" table="EMP" schema="SCOTT" lazy="false"&gt;
<br />
这样就可以直接在页面中取值 (类似于这样的取值 client.cmanager.id)
<br />
如果没有设置 lazy="false" 则会抛出异常
<br />
javax.servlet.ServletException: Exception thrown by getter for property cmanager.realName of bean cl
<br />
在Action中取值的话就会抛出
<br />
could not initialize proxy - the owning Session was closed的异常
<img src ="http://www.blogjava.net/nkjava/aggbug/258655.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/nkjava/" target="_blank">草原上的骆驼</a> 2009-03-09 19:41 <a href="http://www.blogjava.net/nkjava/archive/2009/03/09/258655.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>