Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Nested class , Serialization, read/take is not working

Hi
I am implementing a persistent , partitioned space topology with hibernate as data source.

Now I have 2 classes-> Person, Room
Many persons can stay in one room. Person->Room is many to one. I wanted unidirectional association.

Now when I try to read Person class (it stores the room object) the system simply keeps quiet.

Initially when I had serialization mode=0, I had an error saying "must also implement the hashCode and equals methods,"

I tried with serialization mode to 1 (light) and 2 (full) and the error went away. But the read operation does not go ahead. There is no error given. But simple the program keeps quiet

I have the following mappings->

<hibernate-mapping>
    <class name="bh.Person" table="Person">
        <id name="id" type="integer">
            <column name="ID" />
            <generator class="assigned" />
        </id>
        <property name="firstName" type="string">
            <column name="FIRSTNAME" length="20" />
        </property>
        <property name="lastName" type="string">
            <column name="LASTNAME" length="20" />
        </property>
<many-to-one name="room" column="roomId" not-null="true" />

</class>
</hibernate-mapping>

<hibernate-mapping>
    <class name="bh.Room" table="Room">
        <id name="id" type="integer">
            <column name="id" />
            <generator class="assigned" />
        </id>
        <property name="name" type="string">
            <column name="name" />
</property>

<!-- <set name="persons" inverse="true">
            <key column="roomId"/>
            <one-to-many class="Person"/>
</set>-->

</class>
</hibernate-mapping>

This thread was imported from the previous forum.
For your reference, the original is available here

asked 2008-01-17 01:03:43 -0500

bahata gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

Hibernate associations and the other hibernate lazy load options are not supported with the HibernateDataSource.
You need to load the whole parent object including its child objects into the space.

If you would like to implement 'lazy load' of the child objects you should do that via a getter method that will fetch the child objects stored within the space as separate space (and database rows) entries.
Advanced implementations can use the UID operations.

Serialization mode 1 or 2 are not relevant here. Please stay with serialization mode 0.
Shay

answered 2008-01-18 16:55:10 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Dear Shay I am trying with serialization mode 0. I have made the classes serializable with hashcode and equals methods implemented. Still the system can not read the person objects that are already loaded as they are having room as their field. The classes folder was in classpath while creating the spaces. Still if I try to see the Room classes with object inspector, it is saying that the class should be in the classpath of the space.

You said: "Hibernate associations and the other hibernate lazy load options are not supported with the HibernateDataSource. You need to load the whole parent object including its child objects into the space.

If you would like to implement 'lazy load' of the child objects you should do that via a getter method that will fetch the child objects stored within the space as separate space (and database rows) entries. Advanced implementations can use the UID operations. "

Then do I have to replace all the hibernate associations ? Can you give examples of the different ways you mentioned ? I am just getting stuck here. I do not find any document helpful. Please help.

bahata gravatar imagebahata ( 2008-02-05 20:41:03 -0500 )edit

Dear Shay To describe my problem in more detail, 1)the application we are trying to scale up has POJOs using Integer values as their IDs 2) The POJOs are not keeping the UIDs /ids but the objects themselves as their member fields 3)They use hibernate associations to maintain the object hierarchy

Now how do I manage the object hierarchy in this partitioned persistent spaces?

bahata gravatar imagebahata ( 2008-02-06 01:43:37 -0500 )edit
shay hassidim gravatar imageshay hassidim ( 2008-02-06 07:58:08 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2008-01-17 01:03:43 -0500

Seen: 67 times

Last updated: Jan 18 '08