-->
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: EOFException
PostPosted: Tue Dec 02, 2003 9:31 am 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
Hey folks,
i don't know if it's a hibernate specific problem!
2 users before me has [/i]an equal problem but no solution!

http://forum.hibernate.org/viewtopic.php?t=925672&highlight=eofexception
http://forum.hibernate.org/viewtopic.php?t=924626&highlight=eofexception

I have bidirectional one-to-many beetween JasBean(parent) and KeyValueTuple(child)!
The KeyValueTuple has as a property an object, so it has two columns for the id and the class-name to reference the object!

The insert does work, everythings in my database as i want,
but if i try to get acces on the JasBean as follow:

Code:
currentSession().delete("from  JasBean  as t ");

or
Code:
currentSession().find("from JasBean as t where t.uniqueSequence > 0" );


the following error occured:
Code:
   [junit]    Caused an ERROR
       [junit] could not deserialize
       [junit] net.sf.hibernate.type.SerializationException: could not deserialize
       [junit]    at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:197)
       [junit]    at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:220)
       [junit]    at net.sf.hibernate.type.SerializableType.fromBytes(SerializableType.java:73)
       [junit]    at net.sf.hibernate.type.SerializableType.get(SerializableType.java:38)
       [junit]    at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:62)
       [junit]    at net.sf.hibernate.type.NullableType.nullSafeGet(NullableType.java:74)
       [junit]    at net.sf.hibernate.type.ObjectType.hydrate(ObjectType.java:109)
       [junit]    at net.sf.hibernate.loader.Loader.hydrate(Loader.java:606)

...

   [junit] Caused by: java.io.EOFException
       [junit]    at java.io.ObjectInputStream$BlockDataInputStream.readFully(ObjectInputStream.java:2581)
       [junit]    at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1834)
       [junit]    at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
       [junit]    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
       [junit]    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
       [junit]    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
       [junit]    at net.sf.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:190)


The intersting point is, if there are 20 KeyValueTuples in database everything works fine, just if there are 32 or more KeyValueTuples the above error occured!

the following statement, is the last before the error:
Code:
[STDOUT] Hibernate: select keyvalue0_.uniqueSequence as uniqueSe1_, keyvalue0_.TupleKey as TupleKey, keyvalue0_.class_name as class_name, keyvalue0_.class_id as class_id from KeyValueTuple keyvalue0_


I think it could be a mysql buffer-size-problem,
i've done something wrong with the relation or the object as property!?


somebody have an idea?
N8chtschwaermer


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 02, 2003 2:44 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
maybe the mappings could help:

from JasBean:
Code:
<hibernate-mapping>
    <class
        name="org.weta.jas.hibernate.JasBeanImpl"
        table="JasBean"
        polymorphism="implicit"
        discriminator-value="J"
    >

        <id
            name="uniqueSequence"
            column="uniqueSequence"
            type="long"
            unsaved-value="null"
        >
            <generator class="native">
            </generator>
        </id>

        <discriminator
            column="class"
            type="character"
        />

        <set
               name="KeyValueTuples"
               lazy="false"
               inverse="true"
               cascade="all-delete-orphan">
             <key column="fkJasBean"/>
             <one-to-many class="org.weta.jas.hibernate.KeyValueTuple"/>
        </set>
     
    </class>
</hibernate-mapping>


from KeyValueTuple:

Code:
<hibernate-mapping>
    <class
        name="org.weta.jas.hibernate.KeyValueTuple"
        table="KeyValueTuple"
    >

        <id
            name="uniqueSequence"
            column="uniqueSequence"
            type="long"
            unsaved-value="any"
        >
            <generator class="native">
            </generator>
        </id>

        <property
            name="key"
            type="java.lang.String"
            column="TupleKey"
        />

        <property
            name="value"
            type="object"
        >
            <column
                name="class_name"
            />
            <column
                name="class_id"
            />
        </property>

        <many-to-one
            name="jasBean"
            column="fkJasBean"
            not-null="true"
        />

    </class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject: serializable property
PostPosted: Tue Dec 02, 2003 3:11 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
i've found a post to this problem in the old forum! (after hours)

http://forum.hibernate.org/old/919545.html

in the end he said:
Quote:
I had reference to a serializable property elsewhere in the object graph... it was causing the problems!


exactly!
I had a reference to a serializable property too?
But whats the problem with doing that???
I thought a property which type is Object was created to reference another serializable property !?


The property value from KeyValueTuple which type is Object could, be a String!
So i wrote a wrapper class HString which has one property whose type is String.

But also if i could handle this in another way, the value should also be able to reference to another JasBean (which is the parent fom KeyValueTuple)!

N8chtschwaermer


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 3:01 pm 
Beginner
Beginner

Joined: Thu Nov 20, 2003 12:29 pm
Posts: 39
my mistake, i use a property which type is object instead of Any type mappings

from reference (5.2.5.):
Quote:
The old object type that filled a similar role in Hibernate 1.2 is still supported, but is now semi-deprecated.



the KeyValueTuple mapping looks in this way now :

Code:
hibernate-mapping>
    <class
        name="org.weta.jas.hibernate.KeyValueTuple"
        table="KeyValueTuple"
    >

        <id
            name="uniqueSequence"
            column="uniqueSequence"
            type="long"
            unsaved-value="any"
        >
            <generator class="native">
            </generator>
        </id>

        <property
            name="key"
            type="java.lang.String"
            column="TupleKey"
        />

        <any
            name="value"
            id-type="long"
            cascade="all"
        >
            <column
                name="class_name"
            />
            <column
                name="class_id"
            />
        </any>

        <many-to-one
            name="jasBean"
            column="fkJasBean"
            not-null="true"
        />

     </class>

</hibernate-mapping>


and it works...


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.