Question

I have a simple question but i can't find a answer for Java EE 6!

Should a stateful session bean implements Serializable or not?

I tested with and without implementing java.io.Serializable and there is no different and no errors.

My feeling tells me, that a stateful session bean MUST implements Serializable because it can be persisted in a long term session...

Était-ce utile?

La solution

No, it doesn't need to as the specification does not require that.

You may download and check the EJB specification from: https://jcp.org/en/jsr/detail?id=318

Autres conseils

It depends how you are going to use it:

@Remote: Denotes a remote business interface. Method parameters are passed by value and need to be serializable as part of the RMI protocol.

@Local: Denotes a local business interface. Method parameters are passed by reference from the client to the bean.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top