3 Replies Latest reply on Jul 27, 2007 6:07 AM by yohann Normandin

    @DataModelSelection and ClassCastException

    yohann Normandin Newbie

      Hello everybody...

      I'm stuck for a couple of days with an error that makes me becoming crazy !!!
      I have an .xhtml page (i work with facelets) which code is :

      <h:dataTable id="lines" value="#{lines}" var="line" rendered="#{lines.size>0}">
       <h:column>
       <f:facet name="header">#{messages['Line']}</f:facet>
      
       <s:link action="#{LineManager.selectLine(line.lineId)}" value="#{line.lineId}" propagation="join"/>
       </h:column>
       <h:column>
       <f:facet name="header">#{messages['Product']}</f:facet>
       #{line.productId.prodName}
       </h:column>
       </h:dataTable>
      


      My LineManager is coded as below:
      @Stateful
      @Name("LineManager")
      @Scope(SESSION)
      public class LineManager implements LineManagerLocal, Serializable {
      
       @In
       private EntityManager em;
      
       @DataModel("lines")
       List<OrderLine> lines;
       @DataModelSelection("lines")
       private OrderLine currentOrderLine;
      
      
       @Out
       private Order myOrder;
      
       @Factory(value="lines",scope=SESSION)
       public List<OrderLine> findlines(){
      
       return myOrder.getOrderLines();
      
       }
      
       @Factory(value="servs",scope=SESSION)
       public List<Server> searchServers(){
      
       return currentOrderLine.getServers();
      
       }
      
       @Begin(join=true)
       public void viewParameters(Order order){
       myOrder=em.merge(order);
       System.out.println("on rentre dans le line manager");
       }
      
       public List<OrderLine> getLines(){
       return lines ;
       }
      
       @Begin(nested=true)
       public void selectLine(Long id){
       currentOrderLine=em.find(OrderLine.class,id);
       }
      
      
       public OrderLine getCurrentOrderLine() {
       return currentOrderLine;
      
       }
      
      
       public void setCurrentOrderLine(OrderLine currentOrderLine) {
       this.currentOrderLine = currentOrderLine;
       }
      
      
       @Remove @Destroy
       public void destroy(){
       }
      
       public Order getMyOrder() {
       return myOrder;
       }
      
       public void setMyOrder(Order myOrder) {
       this.myOrder = myOrder;
       }
      }
      

      When I click on an OrderLine on the page, i get an exception
      I show you the StackTrace :
      
       An exception was thrown during an ejb invocation on [LineManager]
      javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java.lang.ClassCastException: org.hibernate.collection.PersistentBag
      java.lang.ClassCastException: org.hibernate.collection.PersistentBag
       at org.jboss.seam.databinding.DataModelBinder.getSelection(DataModelBinder.java:19)
       at org.jboss.seam.Component.injectDataModelSelection(Component.java:1274)
       at org.jboss.seam.Component.injectDataModelSelections(Component.java:1254)
       at org.jboss.seam.Component.inject(Component.java:1196)
       at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:54)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
       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:585)
       at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:560)
       at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:470)
       at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:192)
       at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3922)
       at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:184)
       at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:70)
       at $Proxy656.selectLine(Unknown Source)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
       at org.javassist.tmp.java.lang.Object_$$_javassist_41.selectLine(Object_$$_javassist_41.java)
       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:585)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:174)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:284)
       at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
       at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
       at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
       at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:148)
       at org.jboss.seam.core.Pages.callAction(Pages.java:499)
       at org.jboss.seam.core.Pages.enterPage(Pages.java:282)
       at org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:276)
       at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:214)
       at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:56)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
       at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:258)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:189)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
       at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:81)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:193)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
       at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:255)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)
       at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
       at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)
      javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java.lang.ClassCastException: org.hibernate.collection.PersistentBag
       at com.sun.ejb.containers.BaseContainer.checkExceptionClientTx(BaseContainer.java:3672)
       at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3520)
       at com.sun.ejb.containers.StatefulSessionContainer.postInvokeTx(StatefulSessionContainer.java:1360)
       at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1305)
       at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1267)
       at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
       at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:70)
       at $Proxy656.selectLine(Unknown Source)
       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:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
       at org.javassist.tmp.java.lang.Object_$$_javassist_41.selectLine(Object_$$_javassist_41.java)
       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:585)
       at com.sun.el.parser.AstValue.invoke(AstValue.java:174)
       at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:284)
       at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
       at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
       at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
       at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:148)
       at org.jboss.seam.core.Pages.callAction(Pages.java:499)
       at org.jboss.seam.core.Pages.enterPage(Pages.java:282)
       at org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:276)
       at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:214)
       at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:56)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:398)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
       at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:258)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:189)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
       at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:81)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:193)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
       at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:255)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)
       at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)
       at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)
       at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
       at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)
      


      I debugged this with NetBeans and went into injectDataModelSelection() which is in Component.java (package org.jboss.seam). It works just fine until it arrives on the line
      Object selectedIndex = wrapper.getSelection(dataModelAnn, dataModel);
      

      Trying to step into this line, it gets directly into BijectionInterceptor.java and crashes with the exception above. It seems that it never enters DataModelBinder.java (i put a breakpoint on the first line of getSelection(), but it crashed before reaching this breakpoint)
      This is just to explain where it seems to crash...
      Just another thing, it behaves exactly the same even if currentOrderLine is not annotate with @DataModelSelection (you can see that i try to pass the llineId in the selectline() method).

      I hope somebody could help me a bit
      Thanks for having reached this point in your reading

        • 1. Re: @DataModelSelection and ClassCastException
          Alex Ka Novice

          ClassCastException with two times the same class:

          javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: java
          .lang.ClassCastException: org.hibernate.collection.PersistentBag
          java.lang.ClassCastException: org.hibernate.collection.PersistentBag


          This tells me that you have two different versions of the class that is used. Two imports of hibernate jars, something like that...

          • 2. Re: @DataModelSelection and ClassCastException
            yohann Normandin Newbie

            thanks for your reply...

            After some check of my .ear, there's no duplicate import of hibernate... To make some stuff working, I had to add these jars to the glassfish lib directory:
            hibernate-all.jar
            thirdparty-all.jar
            jboss-archive-browsing.jar
            In my ear and my war, all the jars i have are :
            EAR :
            commons-beanutils-1.7.0.jar
            commons-collections-3.1.jar
            commons-digester-1.6.jar
            el-api.jar
            el-ri.jar
            jboss-seam-debug.jar
            jboss-seam.jar
            jsf-facelets.jar
            WAR (under WEB-INF/lib):
            ajax4jsf-1.1.1.jar
            jboss-seam-ui.jar
            oscache-2.3.2.jar
            richfaces-3.0.1.jar
            That's a bit weird, because the page before the one which raise the exception contains a DataModel, and it works just fine...
            All i have to do is to display in a first page a list of orders you can click on, then display the orderlines relatives to this order and when a user clicks on a orderline, he may see the items that are relative to it. It crashes when the user clicks on the orderline...

            • 3. Re: @DataModelSelection and ClassCastException
              yohann Normandin Newbie

              I begin to see that i've done all that stuff in a pretty wrong way.
              The factory on "lines" returns what it is used by JSF to display the lines. The DataModel were not used to outject lines, or used in a wrong way.
              I changed a bit my code and get rid of the factory.
              Now, the Datamodel is well outjected, and the DataModelSelection is well injected.
              I've got a little problem, however. When I click on the line to select it (an <s:link> with the actionMethod selectline()), it would normally send me to another page, displaying another list.
              But the page stays the same, and i have no exception sent.
              I show you my new code :
              pages.xml :

               <page view-id="/client_prod">
               <navigation from-action="#{LineManager.selectLine(line)}">
               <rule if="#{identity.loggedIn}">
               <redirect view-id="/client_m.xhtml"/>
               </rule>
               </navigation>
               </page>
              

              LineManager.java :
              @Stateful
              @Name("LineManager")
              @Scope(SESSION)
              public class LineManager implements LineManagerLocal, Serializable {
              
               @In
               private EntityManager em;
              
               @DataModel("lines")
               List<OrderLine> lines;
              
              
              
               @DataModelSelection("lines")
               private OrderLine currentOrderLine;
              
              
               @Out
               private Order myOrder;
              
               public List<OrderLine> findlines(){
               lines=myOrder.getOrderLines();
               return lines;
               }
               @Factory(value="servs",scope=SESSION)
               public List<Server> searchServers(){
               return currentOrderLine.getServers();
               }
               @Begin(join=true)
               public void viewParameters(Order order){
               myOrder=em.merge(order);
               System.out.println("on rentre dans le line manager");
               findlines();
               }
               public List<OrderLine> getLines(){
               return lines ;
               }
               @Begin(join=true)
               public void selectLine(Long id){
               //currentOrderLine=em.find(OrderLine.class,id);
               }
               public OrderLine getCurrentOrderLine() {
               return currentOrderLine;
              
               }
               public void setCurrentOrderLine(OrderLine currentOrderLine) {
               this.currentOrderLine = currentOrderLine;
               }
               @Remove @Destroy
               public void destroy(){
               }
               public Order getMyOrder() {
               return myOrder;
               }
               public void setMyOrder(Order myOrder) {
               this.myOrder = myOrder;
               }
              
              }
              

              the code is a bit messy, since i made several tests. i'll make it up later, when i find a solution to my problem.
              Thanks to those who read that