Domanda

I have a class that has marked two fields serilizeable

@Transient
private List<Edge> edges;

@Transient
private List<Cell> cells;

and this works when I get instances of this from the server to my application. Which is an application client. When I try to save an instance of this class back to the server I get serilisation error.

WARNING: 00100006: Class pojo.Cell is not Serializable
at beans._MazeBeanRemote_Wrapper.saveMaze(beans/_MazeBeanRemote_Wrapper.java)

Can someone tell me why I get this error and how I can fix it?

È stato utile?

Soluzione

It seems like your annotations are not working.

Try to make your fields simply private transient.

Altri suggerimenti

Have you implemented Serializable interface in your class?

And transient means that this particular field will not be serialized.

Maybe there is a confusion, there are two kinds of Transient:

transient : java keyword to denote a field that will not be serializable

@Transient : JPA annotation that indicates that the field will not be persisted

In your case the enclosing class could implement the Serializable interface, and mark the fields (and the classes of the fields) with transient.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top