Return-Path: X-Original-To: apmail-openjpa-users-archive@minotaur.apache.org Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AC7F2D8AB for ; Thu, 30 Aug 2012 15:32:30 +0000 (UTC) Received: (qmail 83699 invoked by uid 500); 30 Aug 2012 15:32:30 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 83613 invoked by uid 500); 30 Aug 2012 15:32:30 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 83604 invoked by uid 99); 30 Aug 2012 15:32:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Aug 2012 15:32:30 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of maxtorzito@gmail.com designates 74.125.82.52 as permitted sender) Received: from [74.125.82.52] (HELO mail-wg0-f52.google.com) (74.125.82.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Aug 2012 15:32:22 +0000 Received: by wgbfg15 with SMTP id fg15so1493599wgb.9 for ; Thu, 30 Aug 2012 08:32:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=/lhfa8rOcuNUAx/GV6b+d2lxkg54uS/pWBR3aMNfkRM=; b=srg8b47QrX08GgvBR20fPfdGr4qxOESpTEYGVTNYMc/zKBOZyARR45dD5cF0FDDl+g 8ULvwriPGHpLx1+gayM0XwXvAdn5rj8D5+LTZK4Ga73sTKObI6D5pmjbYrUrp/s3TfJ/ cC2mfI0fuf33pDcPmO2jSsld9+9TmGll3lDSPwzaUEL9mIQCoLUqQqD+PVxQq08pMxvm +LhO0+imDVvu58DPUmbRaeN1z7Z8bbE1YNtsleUKwqOO95LUKa82gxrggu39/kpfsGqU xbkh9JCmwzYCgZw23YLBoOv9CYBwoEoVh6Rzk3v6/IcWrH4iljoSJ1O+6nl5o1I//QeT Cjdg== MIME-Version: 1.0 Received: by 10.180.107.163 with SMTP id hd3mr1277708wib.19.1346340721913; Thu, 30 Aug 2012 08:32:01 -0700 (PDT) Received: by 10.194.14.102 with HTTP; Thu, 30 Aug 2012 08:32:01 -0700 (PDT) Date: Thu, 30 Aug 2012 10:32:01 -0500 Message-ID: Subject: DelagatingResultList From: =?ISO-8859-1?Q?Jos=E9_Luis_Cetina?= To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=e89a8f6474fd79f04804c87d6043 --e89a8f6474fd79f04804c87d6043 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi. I have a problem using myfaces 2.1.8 + openjpa 2.2.0 + primefaces 3.4-SNAPSHOT. I dont know if asked this in myfaces list or here, anyway, i hope somebody can help me. I have 2 SelectOneMenu in a composite component(cc), this cc has a componentType in a facescomponent class. The first selectonemenu have a change event in the cc, when this event is fired the second selectonemenu load data from the database. In the facescomponent class i use statehelper to save the state of the 2 selectonemenu's, but i have a problem: This is the scenario: I have this in my database: Table country: id name 1 Spain 2 Mexico 3 USA Table cities: id fk name 1 3 New York 2 3 LA When my page load the country selectonemenu show all the countries without problem (i retrive them using openjpa), in the cities selectonemenu's show nothing because Spain doesnt have cities, well then if i select Mexico my valuechangelistener method execute and load all the cities, but Mexico doesnt have nothing in the database then again nothing showed as expected, then if a select USA the cities are retrived OK and they are shown in the cities selectonemenu although if i select another city like Spain i can see this error (my valuechangelistener never get called again): java.lang.InstantiationException: org.apache.openjpa.kernel.DelegatingResultList java.lang.InstantiationException: org.apache.openjpa.kernel.DelegatingResultList at java.lang.Class.newInstance0(Class.java:357) at java.lang.Class.newInstance(Class.java:325) at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.= java:1842) at javax.faces.component._DeltaStateHelper.restoreState(_DeltaStateHelper.java= :616) at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:202= 1) at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.res= toreStateFromMap(DefaultFaceletsStateManagementStrategy.java:661) at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.res= toreStateFromMap(DefaultFaceletsStateManagementStrategy.java:680) at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.res= toreStateFromMap(DefaultFaceletsStateManagementStrategy.java:680) at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.res= toreStateFromMap(DefaultFaceletsStateManagementStrategy.java:680) at org.apache.myfaces.view.facelets.DefaultFaceletsStateManagementStrategy.res= toreView(DefaultFaceletsStateManagementStrategy.java:330) at org.apache.myfaces.application.StateManagerImpl.restoreView(StateManagerImp= l.java:130) at org.apache.myfaces.shared.view.ViewDeclarationLanguageBase.restoreView(View= DeclarationLanguageBase.java:106) at org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.restoreView= (FaceletViewDeclarationLanguage.java:2109) at org.apache.myfaces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.= java:300) at com.ocpsoft.pretty.faces.application.PrettyViewHandler.restoreView(PrettyVi= ewHandler.java:109) at org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.WindowContext= AwareViewHandler.restoreView(WindowContextAwareViewHandler.java:122) at org.apache.myfaces.extensions.cdi.jsf.impl.CodiViewHandler.restoreView(Codi= ViewHandler.java:99) at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.j= ava:83) at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.j= ava:83) at org.apache.myfaces.lifecycle.RestoreViewExecutor.execute(RestoreViewExecuto= r.java:127) at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:= 170) at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) = at org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWra= pper.execute(CodiLifecycleWrapper.java:95) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio= nFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC= hain.java:210) at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:145) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio= nFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC= hain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j= ava:225) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j= ava:123) at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBas= e.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:16= 8) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98= ) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927) a= t org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav= a:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)= at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Proc= essor.java:1001) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(Abstra= ctProtocol.java:579) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java= :312) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1= 110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:= 603) at java.lang.Thread.run(Thread.java:722) I observe this: If you select countries that doesnt have cities no error is shown (something like moving from Spain to Mexico and viceversa), but when i select a country like USA that have cities the cities load ok, but if i try to select another country like mexico then the valuechangelistener method never get called again because the exception is thrown. I get the cities using this method: public List getCities(Country country) { CriteriaBuilder cb =3D em.getCriteriaBuilder(); CriteriaQuery cq =3D cb.createQuery(City.class); Root root =3D cq.from(City.class); cq.select(root); cq.where(cb.equal(root.get(City_.countryId).get(Country_.countryId), country.getCountryId())); List resultList =3D (List) em.createQuery(cq).getResultList(); return resultList; } I debug my example and i can see in the saveAttachedState method of UIComponentBase.java the list of cities is a type of DelagatingResultList but i dont understand why, if im doing a cast when i use the getResultList method, why openjpa encapsulate my object in a DelagatingResultList? Then the attachedObject from the saveAttachedState method arrives as DelagatingResultList and then it cant create an instance. What i did is return a manual arraylist something like this, and the exception never thrown. public List getCities(Country country) { ArrayList list =3D new ArrayList(2); list.add(new City("New York")); list.add(new City("LA")); return list; } Finally i dont know what or which is wrong, openjpa or myfaces, openjpa return a DelagatingResultList object and myfaces cant create an instance of that object. What can i do ? --=20 ------------------------------------------------------------------- *SCJA. Jos=E9 Luis Cetina* ------------------------------------------------------------------- --e89a8f6474fd79f04804c87d6043--