[JBoss-user] [EJB 3.0] - Re: ManyToMany biderectional
Any more ideas ? thanks View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3931874#3931874 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3931874 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB 3.0] - Re: ManyToMany biderectional
Thanks Peter for your reply. I agree there is a potential problem there by the relationship between stock and Produit is a One to One, so there are no collections there, but I have fixed the code . I am still getting the same exception with and if I set the fetch type to EAGER I get the following : | java.lang.reflect.UndeclaredThrowableException | at $Proxy0.selectAll(Unknown Source) | at com.elina.commercialis.client.delegate.stock.produit.ProduitDelegate.findAllProduits(ProduitDelegate.java:36) | at com.elina.commercialis.client.gui.model.stock.produit.ProduitTreeModel.initModel(ProduitTreeModel.java:38) | at com.elina.commercialis.client.gui.model.stock.produit.ProduitTreeModel.(ProduitTreeModel.java:29) | at com.elina.commercialis.client.gui.screens.stock.produit.ListProduitPane.initGui(ListProduitPane.java:39) | at com.elina.commercialis.client.gui.screens.stock.produit.ListProduitPane.(ListProduitPane.java:31) | at com.elina.commercialis.client.gui.screens.stock.produit.ProduitTab.initGui(ProduitTab.java:63) | at com.elina.commercialis.client.gui.screens.stock.produit.ProduitTab.(ProduitTab.java:51) | at com.elina.commercialis.client.gui.screens.stock.produit.MajProduit.(MajProduit.java:23) | at com.elina.commercialis.client.actions.stock.ProduitAction.showAdminFrane(ProduitAction.java:75) | at com.elina.commercialis.client.actions.stock.ProduitAction.access$0(ProduitAction.java:69) | at com.elina.commercialis.client.actions.stock.ProduitAction$1.run(ProduitAction.java:64) | at java.awt.event.InvocationEvent.dispatch(Unknown Source) | at java.awt.EventQueue.dispatchEvent(Unknown Source) | at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) | at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) | at java.awt.EventDispatchThread.pumpEvents(Unknown Source) | at java.awt.EventDispatchThread.pumpEvents(Unknown Source) | at java.awt.EventDispatchThread.run(Unknown Source) | Caused by: java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is: | java.lang.NullPointerException | at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:287) | at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:131) | at org.jboss.remoting.Client.invoke(Client.java:258) | at org.jboss.remoting.Client.invoke(Client.java:221) | at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) | at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) | at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) | at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65) | at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98) | at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102) | ... 19 more | Caused by: java.lang.NullPointerException | at com.elina.commercialis.server.stock.produit.Produit.hashCode(Produit.java:151) | at java.util.HashMap.hash(Unknown Source) | at java.util.HashMap.putForCreate(Unknown Source) | at java.util.HashMap.readObject(Unknown Source) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) | at java.lang.reflect.Method.invoke(Unknown Source) | at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) | at java.io.ObjectInputStream.readSerialData(Unknown Source) | at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) | at java.io.ObjectInputStream.readObject0(Unknown Source) | at java.io.ObjectInputStream.defaultReadFields(Unknown Source) | at java.io.ObjectInputStream.readSerialData(Unknown Source) | at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) | at java.io.ObjectInputStream.readObject0(Unknown Source) | at java.io.ObjectInputStream.defaultReadFields(Unknown Source) | at java.io.ObjectInputStream.readSerialData(Unknown Source) | at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) | at java.io.ObjectInputStream.readObject0(Unknown Source) | at java.io.ObjectInputStream.readObject(Unknown Source) | at java.util.HashMap.readObject(Unknown Source) | at sun.reflect.N
[JBoss-user] [EJB 3.0] - Re: ManyToMany biderectional
This doesn't look like an EntityManager bug to me - it looks like a code bug. First, considering that a newly created Produit has a null codeProduit member variable, your hashCode() should really be more resilient against null values for that member. But second, and more critically, you're exposing the incompletely initialized object in your constructor, before the codeProduit value is set. Specifically, you call "stock.setProduit(this)" in the constructor, before Hibernate has set any fields on the Produit object. That's a pretty clear problem. I don't know what the Stock object does with the Produit, but if it puts it in a Collection or references it in its hashCode() you could easily generate an NPE. Probably you want to pull this statement out of the constructor and place it in a separate method that is invoked after the entity's fields are set. I believe there's an annotation hook for that, although I don't know what it is off the top of my head. Check the JBoss docs. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3930476#3930476 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3930476 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user