-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: SerializationException could not deserialize
PostPosted: Sun Jul 24, 2005 7:08 pm 
Newbie

Joined: Sun Jul 24, 2005 7:01 pm
Posts: 3
I don't even know how to start debugging this. Thanks in advance.

Hibernate version:
3
Mapping documents:
Code:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
                            "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                            "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >

<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration.                   -->
<!-- Created Sat Jul 23 10:46:49 PDT 2005                         -->
<hibernate-mapping package="org.illcon.pwkp.biz">

    <class name="Profile" table="profile">
        <id name="id" column="id" type="integer">
            <generator class="increment"/>
        </id>

        <property name="firstName" column="first_name" type="string" />
        <property name="lastName" column="last_name" type="string" />
        <property name="hometown" column="hometown" type="string" />
        <property name="email" column="email" type="string" />
        <property name="personalDescription" column="personal_description" type="serializable" />
        <property name="testimonial" column="testimonial" type="serializable" />
        <property name="otherLocation" column="other_location" type="string" />
        <property name="otherRelationship" column="other_relationship" type="string" />
        <property name="selfImgUrl" column="self_img_url" type="string" />
        <property name="paulImgUrl" column="paul_img_url" type="string" />
        <many-to-one name="childRating" column="child_rating_id" not-null="true" outer-join="false"/>
        <many-to-one name="paulsRating" column="pauls_rating_id" not-null="true" outer-join="false"/>
        <many-to-one name="location" column="location_id" not-null="true" outer-join="false"/>
        <many-to-one name="relationship" column="relationship_id" not-null="true" outer-join="false"/>
        <property name="profileEnteredDate" column="profile_entered_date" type="date" />
    </class>
    <class name="Profile$Location" table="location">
         <id name="id" type="int" unsaved-value="null">
         <column name="location_id" sql-type="int" not-null="true" />
         <generator class="increment" />
         </id>
         <property name="name" column="location_name"/>
   </class>
   <class name="Profile$Relationship" table="relationship">
         <id name="id" type="int" unsaved-value="null">
         <column name="relationship_id" sql-type="int" not-null="true" />
         <generator class="increment" />
         </id>
         <property name="name" column="relationship_name"/>
   </class>
   <class name="Profile$PaulsRating" table="pauls_rating">
         <id name="id" type="int" unsaved-value="null">
         <column name="pauls_rating_id" sql-type="int" not-null="true" />
         <generator class="increment" />
         </id>
         <property name="name" column="pauls_rating_name"/>
   </class>
   <class name="Profile$ChildRating" table="child_rating">
         <id name="id" type="int" unsaved-value="null">
         <column name="child_rating_id" sql-type="int" not-null="true" />
         <generator class="increment" />
         </id>
         <property name="name" column="child_rating_name"/>
   </class>
   
</hibernate-mapping>

Code between sessionFactory.openSession() and session.close():
Code:
    public List find(String queryString, boolean cached)

        throws HibernateException

    {

        try

        {

            Session session = getHibernateSession();

            Query query = session.createQuery(queryString);

            if (cached)

            {

                query.setCacheable(true);

            }

            return query.list();

        }

        catch (Exception e)

        {

            throw new HibernateException(e);

        }

    }

Full stack trace of any exception that occurs:
Code:
Exception in thread "main" org.hibernate.HibernateException: org.hibernate.type.SerializationException: could not deserialize
   at org.illcon.pwkp.data.HibernateHelper.find(HibernateHelper.java:131)
   at org.illcon.pwkp.data.HibernateHelper.find(HibernateHelper.java:113)
   at org.illcon.pwkp.test.TestStuff.testHQL(TestStuff.java:22)
   at org.illcon.pwkp.test.TestStuff.main(TestStuff.java:15)
Caused by: 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:77)
   at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:68)
   at org.hibernate.type.AbstractType.hydrate(AbstractType.java:80)
   at org.hibernate.persister.entity.BasicEntityPersister.hydrate(BasicEntityPersister.java:1690)
   at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:991)
   at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:942)
   at org.hibernate.loader.Loader.getRow(Loader.java:855)
   at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:305)
   at org.hibernate.loader.Loader.doQuery(Loader.java:412)
   at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
   at org.hibernate.loader.Loader.doList(Loader.java:1593)
   at org.hibernate.loader.Loader.list(Loader.java:1577)
   at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
   at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
   at org.illcon.pwkp.data.HibernateHelper.find(HibernateHelper.java:127)
   ... 3 more
Caused by: java.io.EOFException
   at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2232)
   at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2698)
   at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:750)
   at java.io.ObjectInputStream.<init>(ObjectInputStream.java:268)
   at org.hibernate.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:246)
   at org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:203)
   ... 23 more


Name and version of the database you are using:
MySQL 4.1

The generated SQL (show_sql=true):
Code:
Hibernate: select profile0_.id as id, profile0_.first_name as first2_0_, profile0_.last_name as last3_0_, profile0_.hometown as hometown0_, profile0_.email as email0_, profile0_.personal_description as personal6_0_, profile0_.testimonial as testimon7_0_, profile0_.other_location as other8_0_, profile0_.other_relationship as other9_0_, profile0_.self_img_url as self10_0_, profile0_.paul_img_url as paul11_0_, profile0_.child_rating_id as child12_0_, profile0_.pauls_rating_id as pauls13_0_, profile0_.location_id as location14_0_, profile0_.relationship_id as relatio15_0_, profile0_.profile_entered_date as profile16_0_ from profile profile0_


Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 7:47 pm 
Senior
Senior

Joined: Thu May 12, 2005 11:40 pm
Posts: 125
Location: Canada
You are probably persisting those serializable properties to a BLOB, and the JDBC driver is fudging the BLOB on return somehow. Are you using Oracle?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 8:52 pm 
Newbie

Joined: Sun Jul 24, 2005 7:01 pm
Posts: 3
I'm not sure what a blob is. I'm not using anything made by Oracle. I'm just running MySQL server on my own machine. I'm pretty sure I have the connection set up correctly since I was getting other things working.

The class that I'm trying to retrieve is Profile (same as the mapping above) that has a couple label-value type inner classes with the query String
Code:
from Profile


Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 9:18 pm 
Newbie

Joined: Sun Jul 24, 2005 7:01 pm
Posts: 3
I think it may have just been bad data. I changed the 'type' in my mapping from 'serializable' to 'string' and it seems to work now.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.