I'm trying to use lazy-loading JPA[Hibernate] with GWT front-end
In entity
@ManyToOne(targetEntity = Item.class,fetch=FetchType.LAZY)
private Item item;
In dao
@Transactional
public List<Purchase> findAllPurchases() {
return jpaTemplate.execute(new JpaCallback<List<Purchase>>(){
public List<Purchase> doInJpa(EntityManager em)
throws PersistenceException {
List<Purchase> list = em.createQuery("select o from Purchase o").getResultList();
for(Purchase p:list){
Item item = p.getItem();
if(item!=null)
item.getItemName();
}
return list;
}
}); }
and I receive this error.
com.google.gwt.user.client.rpc.SerializationException: Type 'com.hardwarestore.vo.Item_$$_javassist_0' 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.hardwarestore.vo.Item@a1eaf6
Both Purchase class and Item class implements Serializable interface. Any kind of help is appreciated. Thank you.