Java Mailing List Archive

http://www.junlu.com/

Google
Google
Mailing List
Home
Forum Home
JBoss - Java Application Server
Tomcat - JSP/Servlet container
Struts - A MVC web framework
iText - An open source PDF Java Library
JDOM - JDOM XML Parser
J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition
JSP - A mailing list about Java Server Pages specification and reference
J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog
Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology
Struts & Hibernate
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
- Re: StaleStateException from entity activation

- Re: StaleStateException from entity activation

2007-07-12       - By matt.drees

 Back
Reply:     1     2     3     4  

Ok, I've reproduced this situation in a simple test:


 | public class PassivatedEntityInParentConversationTest extends SeamTest {
 |
 |   @(protected)
 |   public void test() throws Exception {
 |     String cid = new FacesRequest("/page.xhtml") {
 |       @(protected)
 |       protected void invokeApplication() throws Exception {
 |         Bar bar = new Bar();
 |         bar.setName("bar1");
 |         EntityManager entityManager = (EntityManager) getValue("#{entityManager
}");
 |         entityManager.persist(bar);
 |         Contexts.getConversationContext().set("bar", bar );
 |         Manager.instance().beginConversation();
 |       }
 |     }.run();
 |    
 |     //bar is not passivated, because it was just added
 |
 |     cid = new FacesRequest("/page.xhtml", cid) {
 |     }.run();
 |
 |     //bar is now passivated
 |    
 |     cid = new FacesRequest("/page2.xhtml", cid) {
 |       @(protected)
 |       protected void invokeApplication() throws Exception {
 |         Manager.instance().beginNestedConversation();
 |       }
 |     }.run();
 |    
 |     cid = new FacesRequest("/page.xhtml", cid) {
 |       @(protected)
 |       protected void invokeApplication() throws Exception {
 |         Bar bar = (Bar) Contexts.getConversationContext().get("bar");
 |         bar.setName("bar2");
 |         EntityManager entityManager = (EntityManager) getValue("#{entityManager
}");
 |         entityManager.flush();
 |       }
 |     }.run();
 |
 |     //bar is not passivated, because it is not in the current conversation,
so its wrapper still holds the old version
 |    
 |     cid = new FacesRequest("/page.xhtml", cid) {
 |       @(protected)
 |       protected void invokeApplication() throws Exception {
 |         Manager.instance().endConversation(false);
 |       }
 |     }.run();
 |    
 |     cid = new FacesRequest("/page.xhtml", cid) {
 |     }.run();  //exception occurs here at ConversationContext.unflush
 |   }
 | }
 |

Exception:

 | org.hibernate.StaleStateException Source code of org.hibernate.StaleStateException: current database version number does not
match passivated version number
 |   at org.jboss.seam.persistence.HibernatePersistenceProvider.checkVersion
(HibernatePersistenceProvider.java:174)
 |   at org.jboss.seam.persistence.HibernatePersistenceProvider.checkVersion
(HibernatePersistenceProvider.java:134)
 |   at org.jboss.seam.contexts.PassivatedEntity.checkVersion(PassivatedEntity
.java:133)
 |   at org.jboss.seam.contexts.PassivatedEntity.getEntityFromEntityManager
(PassivatedEntity.java:118)
 |   at org.jboss.seam.contexts.PassivatedEntity.toEntityReference
(PassivatedEntity.java:73)
 |   at org.jboss.seam.contexts.EntityBean.activate(EntityBean.java:67)
 |   at org.jboss.seam.contexts.ServerConversationContext.unflush
(ServerConversationContext.java:234)
 |   at org.jboss.seam.contexts.FacesLifecycle.resumeConversation
(FacesLifecycle.java:129)
 |   at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener
.java:373)
 |   at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase
(SeamPhaseListener.java:211)
 |   at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java
:184)
 |   at org.jboss.seam.mock.BaseSeamTest$Request.restoreViewPhase(BaseSeamTest
.java:706)
 |   at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle
(BaseSeamTest.java:544)
 |   at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:487)
 |   at org.uscm.crs.PassivatedEntityInParentConversationTest.test
(PassivatedEntityInParentConversationTest.java:59)
 |   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 Source code of java.lang.reflect.Method(Method.java:585)
 |   at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:645)
 |   at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:479)
 |   at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:715)
 |   at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker
.java:125)
 |   at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
 |   at org.testng.TestRunner.runWorkers(TestRunner.java:673)
 |   at org.testng.TestRunner.privateRun(TestRunner.java:620)
 |   at org.testng.TestRunner.run(TestRunner.java:480)
 |   at org.testng.SuiteRunner.runTest(SuiteRunner.java:278)
 |   at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:273)
 |   at org.testng.SuiteRunner.privateRun(SuiteRunner.java:253)
 |   at org.testng.SuiteRunner.run(SuiteRunner.java:168)
 |   at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:987)
 |   at org.testng.TestNG.runSuitesLocally(TestNG.java:951)
 |   at org.testng.TestNG.run(TestNG.java:719)
 |   at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
 |   at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:122)
 |

I created a jira issue.
http://jira.jboss.com/jira/browse/JBSEAM-1656 (See http://EAM-1656.ora-code.com)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic
&p=4063690#4063690

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode
=reply&p=4063690
__ ____ ____ ____ ____ ____ ____ ____ ____ ____
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user

©2008 junlu.com - Jax Systems, LLC, U.S.A.