1 Reply Latest reply on Aug 25, 2005 11:52 AM by Emmanuel Bernard

    Interface, query and org.hibernate.type.SerializationExcepti

    J-C jc Apprentice

      Hi,

      I have the following model:

      @Entity()
      public class NodeBO {
       private NodeBO parent;
       private Leaf leaf;
      ...
       public NodeBO getParent() {
       return parent;
       }
      
       public void setParent(NodeBO parent) {
       this.parent = parent;
       }
       public Leaf getLeaf() {
       return leaf;
       }
      
       public void setLeaf(Leaf leaf) {
       this.leaf = leaf;
       }
      }

      Leaf is an interface. I am able to create persistent object. Then I try to retrieve some of it by a query:
      Query q = em.createQuery("SELECT OBJECT(node) FROM NodeBO node");
      Collection<NodeBO> roots = q.getResultList();

      I have the following exception:
      16:05:17,451 INFO [STDOUT] org.hibernate.type.SerializationException: could not deserialize
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:211)
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:234)
       at org.hibernate.type.SerializableType.fromBytes(SerializableType.java:78)
       at org.hibernate.type.SerializableType.get(SerializableType.java:39)
       at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:78)
       at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:69)
       at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
       at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:1761)
       at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1314)
       at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1242)
       at org.hibernate.loader.Loader.getRow(Loader.java:1139)
       at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:552)
       at org.hibernate.loader.Loader.doQuery(Loader.java:666)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:221)
       at org.hibernate.loader.Loader.doList(Loader.java:2001)
       at org.hibernate.loader.Loader.list(Loader.java:1985)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:405)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:293)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:864)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:41)
       at fr.biomerieux.dnachip.classification.ClassificationDAOImpl.findRootNode(ClassificationDAOImpl.java:57)
       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.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:99)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:32)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:113)
       at org.jboss.aspects.tx.TxInterceptor$Mandatory.invoke(TxInterceptor.java:209)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:152)
       at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:60)
       at $Proxy320.findRootNode(Unknown Source)
       at fr.biomerieux.dnachip.classification.NodeABSImpl.getRootNode(NodeABSImpl.java:78)
       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.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:99)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:32)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:66)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:195)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:69)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:566)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:436)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:239)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:291)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:168)
      Caused by: java.io.EOFException
       at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2232)
       at java.io.ObjectInputStream$BlockDataInputStream.readUTFBody(ObjectInputStream.java:2967)
       at java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:2768)
       at java.io.ObjectInputStream.readUTF(ObjectInputStream.java:1021)
       at java.io.ObjectStreamClass.readNonProxy(ObjectStreamClass.java:573)
       at java.io.ObjectInputStream.readClassDescriptor(ObjectInputStream.java:778)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1528)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
       at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:204)
       ... 69 more

      What does it mean ? I suppose something is badly implement in my object/relational mapping but exception is not very clear. Any suggestions are welcome ...

      Regards

      JC