PDA

View Full Version : Wire EJBs over the wire.



powerj
5 Sep 2008, 1:32 AM
Hi.

I am trying to wire Enteprise Java Beans over the wire.

The objects i try to wire are Entity Beans that looks like simple beans, but have som annotations that forms it to Eneity Beans.

The first problem i had was that gwt-compiler was unable to compile my EJBs becouse gwt-1.5 knows about annotations. The annotations required from import javax.persistence.*; was unable to be found, and gwt was failing on me. I quickly creatad some fake-annotations and sence there is to no use for gwt, it compiled successfully.

Fine! i thouth until i loaded the page and tried to wire my List<> of EJBs, gwt-servlet then complained about having problems to serialize the bean for transmission, becouse:


Caused by: com.google.gwt.user.client.rpc.SerializationException: Type 'oracle.toplink.essentials.internal.indirection.UnitOfWorkQueryValueHolder' 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.
I dont really care what additional data my persistence layer ads to my bean, i just want to wire the raw-bean data over.

Is there someone that knows how to make gwt serialize this the right way?

Thanks for your time.
Jimmy


Example Entity Bean:



import javax.persistence.*;

@Entity
@Table(name = "cars")
public class Car implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "car_id", nullable = false)
private Integer carId;
@Column(name = "carnr", nullable = false)
private int carnr;

int getId() { return(this.carId); }
void setId(int id) { this.carId=id; }
int getNr() { return(this.carnr); }
void setNr(int nr) { this.carnr=nr; }
}

gslender
5 Sep 2008, 3:36 AM
you cannot send objects that extend api that GWT doesn't support... you will need to create a pojo and transfer your Enteprise Java Beans into it