-->
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: Serialization exception may be related to hibernate
PostPosted: Thu Jul 08, 2010 6:50 am 
Newbie

Joined: Sun Apr 11, 2010 6:44 am
Posts: 12
Hi,

I keep getting the serialization exception and causing the rpc failed. Can someone tell me what's going on?

com.google.gwt.user.client.rpc.SerializationException: Type 'com.jobscout.frontpage.client.Category$$EnhancerByCGLIB$$424f9bbb' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = com.jobscout.frontpage.client.Category@9cdbbc

I use hibernate to extract the records, put the result in the ArrayList. To test the serialization, I dropped the hibernate part and built the ArrayList of the type in the Impl and it works. So, I am not sure how the hibernate return the arraylist<type> causes the serialization exception.

The following are extracted from my code that is relevent.

public class Job implements Serializable {
private long oid;
private long acctOid;
private String subject;
private String description;
private Category category; //Serializable
private SubCat1 subcat1; //Serializable
private Mesgtype mesgtype; //Serializable


This part is the testing and it works. I create the Arraylist instead of using hibernate to extract records and return an Arraylist.

public ArrayList<Job> getJobAryLstTest(){
ArrayList<Job> jobarylst = new ArrayList<Job>();
Category catparttime = new Category(0,"Parttime");
SubCat1 painter = new SubCat1(0, catparttime,"Partime Painter");
Mesgtype postjobmesgtype = new Mesgtype(0, "Post Job");
Job job1 = new Job(0,"subject1","descruotuib1",catparttime, painter,postjobmesgtype);
Job job2 = new Job(0,"subject2","descruotuib2",catparttime, painter,postjobmesgtype);
jobarylst.add(job1);
jobarylst.add(job2);
return jobarylst;

This part call the hibernate dao and cause serialization exception
public ArrayList<Job> getAllJobAryLst() {
JobDAO jobdao=new JobDAO();
ArrayList<Job> rtnJobList;
rtnJobList = jobdao.getAllJob();
return rtnJobList;
}

This part is the DAO
public ArrayList<Job> getAllJob()
{
ArrayList<Job> rtnAryList=new ArrayList<Job>();
try
{
if(!session.isOpen())
{
session = HibernateUtil.getSessionFactory().openSession();
}
session.beginTransaction();
String hql="from Job job";
rtnAryList = (ArrayList<Job>)session.createQuery(hql).list();
return rtnAryList;
}
catch(Exception e)
{
System.out.println(e.toString());
return null;
}
}

Thanks a lot


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.