Wednesday, July 30, 2014

Hibernate, GWT many to many

Hey all,

after searching the whole for a solution for my problem I am now sharing my problem to you ;).

Well I have this famous error:

java.lang.RuntimeException: Type 'org.hibernate.collection.PersistentSet' 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 = []

I know the description of google where they mention this problem.

Well what I don't understand is this: they still use the hm.xml file to generate the enities right? But how do they make them extending from LightEntity when the entities are generated?

I am asking this because I also generate my entities via Hibernate and this xml:

<class abstract="false"
<meta attribute="extends">net.sf.gilead.pojo.gwt.LightEntity</meta> <!-- that was a try and leads to the same error with the persistentset -->
<meta attribute="implements">com.egrima.webinfotools.common.entity.BasisEntity</meta>
<id column="ID" name="id" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">SEQ_WITPOIS</param>

<property column="ZALTKN" generated="never" lazy="false"
name="zaltkn" length="6" type="java.lang.String" />
<property column="NAME" generated="never" lazy="false" name="name"
length="255" type="java.lang.String" />
<property column="ADDRESS" generated="never" lazy="false"
name="address" length="512" type="java.lang.String" />
<property column="LONGITUDE" generated="never" lazy="false"
name="longitude" type="java.lang.Double" />
<property column="LATITUDE" generated="never" lazy="false"
name="latitude" type="java.lang.Double" />
<property column="ANL_DAT_ZEIT" generated="never" lazy="false"
name="createdDate" type="java.util.Date" />
<property column="AEN_DAT_ZEIT" generated="never" lazy="false"
name="changedDate" type="java.util.Date" />
<property column="TERM" generated="never" name="hostname"
length="12" type="java.lang.String" />
<property column="BEN" generated="never" name="username"
length="8" type="java.lang.String" />

<many-to-one name="category" foreign-key="fk_poi_category" cascade="all"
column="category_id" lazy="false"    class="com.egrima.webinfotools.common.entity.generated.PointOfInterestCategory" />
<one-to-one name="poiNameTranslation" lazy="false" cascade="all"  foreign-key="fk_witpoi_translation" class="com.egrima.webinfotools.common.entity.generated.PointOfInterestTranslation"/>
<set name="attributes" inverse="true" table="witpoi_attribute" lazy="false" cascade="all" fetch="select">
<key column="POI_ID"/>
<many-to-many  class="com.egrima.webinfotools.common.entity.generated.PointOfInterestAttribute" column="ATTRIBUTE_ID"   fetch="join"/>

well and this is my generated class out of this:

package com.egrima.webinfotools.common.entity;
// Generated 30.07.2014 11:21:02 by Hibernate Tools 3.2.2.GA

import com.egrima.webinfotools.common.entity.generated.PointOfInterestAttribute;
import com.egrima.webinfotools.common.entity.generated.PointOfInterestCategory;
import com.egrima.webinfotools.common.entity.generated.PointOfInterestTranslation;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

 * PointOfInterest generated by hbm2java

public class PointOfInterest extends net.sf.gilead.pojo.gwt.LightEntity implements com.egrima.webinfotools.common.entity.BasisEntity, {

private static final long serialVersionUID = 42L;

private Long id;
private String zaltkn;
private String name;
private String address;
private Double longitude;
private Double latitude;
private Date createdDate;
private Date changedDate;
private String hostname;
private String username;
private PointOfInterestCategory category;
private PointOfInterestTranslation poiNameTranslation;
private Set<PointOfInterestAttribute> attributes = new HashSet<PointOfInterestAttribute>(0);

public PointOfInterest() {

public PointOfInterest(String zaltkn, String name, String address, Double longitude, Double latitude, Date createdDate, Date changedDate, String hostname, String username, PointOfInterestCategory category, PointOfInterestTranslation poiNameTranslation, Set<PointOfInterestAttribute> attributes) {
this.zaltkn = zaltkn; = name;
this.address = address;
this.longitude = longitude;
this.latitude = latitude;
this.createdDate = createdDate;
this.changedDate = changedDate;
this.hostname = hostname;
this.username = username;
this.category = category;
this.poiNameTranslation = poiNameTranslation;
this.attributes = attributes;

public Long getId() {
return id;
public void setId(Long id) { = id;
public String getZaltkn() {
return zaltkn;
public void setZaltkn(String zaltkn) {
this.zaltkn = zaltkn;
public String getName() {
return name;
public void setName(String name) { = name;
public String getAddress() {
return address;
public void setAddress(String address) {
this.address = address;
public Double getLongitude() {
return longitude;
public void setLongitude(Double longitude) {
this.longitude = longitude;
public Double getLatitude() {
return latitude;
public void setLatitude(Double latitude) {
this.latitude = latitude;
public Date getCreatedDate() {
return createdDate;
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
public Date getChangedDate() {
return changedDate;
public void setChangedDate(Date changedDate) {
this.changedDate = changedDate;
public String getHostname() {
return hostname;
public void setHostname(String hostname) {
this.hostname = hostname;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
public PointOfInterestCategory getCategory() {
return category;
public void setCategory(PointOfInterestCategory category) {
this.category = category;
public PointOfInterestTranslation getPoiNameTranslation() {
return poiNameTranslation;
public void setPoiNameTranslation(PointOfInterestTranslation poiNameTranslation) {
this.poiNameTranslation = poiNameTranslation;
public Set<PointOfInterestAttribute> getAttributes() {
return attributes;
public void setAttributes(Set<PointOfInterestAttribute> attributes) {
this.attributes = attributes;


in general without the "LigthEntity" extending because that was just a try as you can see at the comment in the xml file right to the < meta> -Tag. In general it just implements BasisEntity and Serializable.

So what can I do to solve my problem that the Set is understood in the browserworld?

I really have no clue anymore how to solve this. so please help me :)


You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment