0

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?

Sergio
  • 3,317
  • 5
  • 32
  • 51
onesixtyfourth
  • 744
  • 9
  • 30

3 Answers3

0

Have you implemented Serializable interface in your class?

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

XpressOneUp
  • 195
  • 10
  • I haven't implemented serializeable because I don't want these fields to be serializeable. This is why they are marked @Transient but it only seems to work one way. – onesixtyfourth Feb 19 '14 at 17:03
  • In this case you basically should implement Serializable, but mark those fields as transient. So the rest of the fields will be serialized except of `edges` and `cells` – XpressOneUp Feb 19 '14 at 17:06
0

It seems like your annotations are not working.

Try to make your fields simply private transient.

Eel Lee
  • 3,513
  • 2
  • 31
  • 49
0

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.

Sergio
  • 3,317
  • 5
  • 32
  • 51