-->
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: ClassNotFoundExceptionorg.hibernate.collection.PersistentSet
PostPosted: Thu Feb 09, 2006 1:31 pm 
Newbie

Joined: Thu Feb 09, 2006 1:22 pm
Posts: 13
Location: Turkey
Hi all,

I have a mapper like this :

<?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>

<!-- HESAPPLAN -->
<class name="tr.com.usta.ITBMuhasebeOrtak.core.dvo.muhasebe.HesapPlan" table="U_HESAPPLANI">
<id name="hesapkod" column="HESAPKOD">
<generator class="native"/>
</id>
<property name="usthesapkod" column="USTHESAPKOD" length="30" not-null="false"/>
<property name="hesapad" column="HESAPAD" length="60" not-null="true"/>
<property name="detay" column="DETAY" length="1" not-null="true"/>
<property name="kirilimsayisi" type="integer" column="KIRILIMSAYISI" not-null="true"/>
<property name="seviye" column="SEVIYE" type="integer" not-null="true"/>
<property name="bilanco" column="BILANCO" length="5" not-null="true"/>
<property name="gelirtablosu" column="GELIRTABLOSU" length="1" not-null="true"/>
<property name="butce" column="BUTCE" length="1" not-null="true"/>
<property name="borcalacak" column="BORCALACAK" length="7" not-null="true"/>
<property name="demirbas" column="DEMIRBAS" length="1" not-null="true"/>
<set name="butceList" inverse="true" lazy="true">
<key column="HESAPKOD"/>
<one-to-many class="tr.com.usta.ITBMuhasebeOrtak.core.dvo.muhasebe.Butce"/>
</set>
</class>

<!-- BUTCE -->
<class name="tr.com.usta.ITBMuhasebeOrtak.core.dvo.muhasebe.Butce" table="U_BUTCE">
<id name="butcekod" column="BUTCEKOD">
<generator class="native"/>
</id>
<property name="borc" column="BORC" type="double" not-null="true"/>
<property name="alacak" column="ALACAK" type="double" not-null="true"/>
<property name="dovizborc" type="double" column="DOVIZBORC" not-null="true"/>
<property name="dovizalacak" column="DOVIZALACAK" type="integer" not-null="true"/>
<property name="pbkod" column="PBKOD" length="5" not-null="false"/>
<property name="tarih" column="TARIH" type="date" not-null="false"/>
<property name="aciklama2" column="ACIKLAMA2" length="100" not-null="false"/>
<property name="aciklama" column="ACIKLAMA" length="100" not-null="false"/>
<many-to-one name="hesapplan"
column="HESAPKOD"
class="tr.com.usta.ITBMuhasebeOrtak.core.dvo.muhasebe.HesapPlan"
not-null="true"/>
</class>

</hibernate-mapping>

As you see here when i search on "HESAPLAN" i try to get "BUTCE" as a collection in which has a "Set" type. When i want from Hibernate to take me data for "HESAPPLAN", on Applet side it gives the "ClassNotFoundException:org.hibernate.collection.PersistentSet".

I use Apache Tomcat 4.1 and Hibernate 3. My Applet communicates with Hibernate side through a servlet and it gives and takes object through stream. The exception is raised while reading result from servlet like this :
InputStream is = connection.getInputStream();
ObjectInputStream ois = new ObjectInputStream(is);
setSonucMesaj((SonucMesaj) ois.readObject());
ois.close();

The bold line reads the message and set the result. So what do you think about this error?

Yours sincerely,[/b]

_________________
eRoHaN


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 09, 2006 6:11 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
PersistentSet is in hibernate3.jar. You have two options: either add hibernate3.jar to your applet's classpath, adding to its download time; or add code to this effect in your servlet:
Code:
haspPlan.setButceList(new HashSet(haspPlan.getButceList());
Seeing as your applet won't have access to your session, this solution offsets its ugliness by guaranteeing that you won't get lazy initialization errors (because the set is inflated during the PersistentSet -> HashSet conversion).


Top
 Profile  
 
 Post subject: Hibernate does not do its job i think
PostPosted: Fri Feb 10, 2006 3:47 am 
Newbie

Joined: Thu Feb 09, 2006 1:22 pm
Posts: 13
Location: Turkey
But think like that:

I have got a servlet which takes my job objests named as "Islem" from ObjectStream and redirect to appropriate HibernateUtil method through getting a specified field in "Islem" which holds the job_type.

As soon as hibernate does its job it must convert the PersistentSet to java.util.Set. I opened the org.hibernate.collection.PersistentSet in DJ Decompiler and i saw that it really converts...:)

So, before the communicator controller class ("ProcessManager") reads result, in the stream it must exist as java.util.Set!

I also try your suggestion to put hibernate3.jar to applet's archieve tag it works but it is not a nice solution to wait a 1.86 MB download.

I mean when i call the 'List list = session.createQuery("bla bla").list();', the result of each element in list must have its java.util.Set typed field if any record exist with lazy = false criteria.

Regards,

_________________
eRoHaN


Top
 Profile  
 
 Post subject: Interface != class
PostPosted: Sun Feb 12, 2006 4:19 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Set is an interface. Every object implementing Set must also implement a concrete class: in this case, PersistentSet. You have to either make the implementation class available to your applet, or change the class to one that's already available.


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.