-->
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.  [ 1 post ] 
Author Message
 Post subject: POJO classes -RMI marshalling exception due to java.util.set
PostPosted: Tue Apr 26, 2005 11:17 am 
Beginner
Beginner

Joined: Tue Feb 01, 2005 8:38 am
Posts: 38
Hibernate version:
3.0

I'm experiencing an RMI Marshalling problem using Hibernate with EJB. The problem isn't so much to do with Hibernate as such - more of a side-effect of using it.

Basically, my POJO class (Country) has a java.util.Set variable because I have a one-to-many relationship in my database between COUNTRY and USER. When I try to return an instance of type Country from an EJB, I am getting an RMI Marshalling exception becuase java.util.Set does not implement Serializable.

This problem does not arise with classes where all the variables are of serializable types.

My Country class looks a bit like this...

Code:
    ...

    private java.lang.String ISOCode;
    private java.lang.String Name;
    private java.lang.String TwoCharacterCode;
    private java.lang.String ThreeCharacterCode;
    private java.lang.String OfficialName;
    private java.lang.String InternationalDialCode;
    private java.util.Set SetOfUser;

    ....







Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
  <class name="com.myApp.common.dto.Country" table="country">
    <id name="ISOCode" type="java.lang.String">
      <column name="ISO_CODE" length="3" not-null="true" sql-type="char" />
      <generator class="assigned"/>
    </id>
    <property name="Name" type="java.lang.String">
      <column name="NAME" length="100" not-null="true" sql-type="varchar" />
    </property>
    <property name="TwoCharacterCode" type="java.lang.String">
      <column name="TWO_CHARACTER_CODE" length="2" not-null="true" sql-type="varchar" />
    </property>
    <property name="ThreeCharacterCode" type="java.lang.String">
      <column name="THREE_CHARACTER_CODE" length="3" not-null="true" sql-type="varchar" />
    </property>
    <property name="OfficialName" type="java.lang.String">
      <column name="OFFICIAL_NAME" length="100" not-null="true" sql-type="varchar" />
    </property>
    <property name="InternationalDialCode" type="java.lang.String">
      <column name="INT_DIAL_CODE" length="5" not-null="true" sql-type="varchar" />
    </property>
    <set name="SetOfUser">
      <key>
        <column name="COUNTRY_ISO_CODE" length="3" not-null="false" unique="true" />
      </key>
      <one-to-many class="com.myApp.common.dto.User" />
    </set>
  </class>
</hibernate-mapping>



Any ideas on how to get around this problem?

Cheers,

:)


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

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.