Serializing reference of @Stateful session beans in EJB 3.1 with GlassFish 3.1

It’s all started with the EJB 2.1 and the javax.ejb.Handle interface. I remember I’ve always been meaning to check it out myself – how it is to save a reference of a stateful session EJB. There’s a myriad of use cases that would justify the need to figure it out – storing a @Stateful EJB reference in a HTTP session that can be serialized – saved to a byte stream – and send over a network to a remote server instance or a remote GUI client that stores a reference to a bean and once it’s up again restores it to continue the EJB session, i.e. use the state on a server. There may also be a use case for passing a reference on to another client, possibly on a different JVM.

The matter is all about serializing a reference of a @Stateful session bean.

The current EJB version is 3.1 with 3.0 in between. The interface is still in the EJB 3.1 specification, but it’s merely for pre-EJB 3.0 developments (backward-compatibility). You can use the interface but I guess you’ll surely not. The question has thus remained and with no need to implement any interface or extend a superclass to implement a @Stateful bean it was mysterious even more.

Interested reading more? Head to my wiki where I published an article Serializing reference of @Stateful session beans in EJB 3.1 with GlassFish 3.1.

Although I partly sorted out the issue, the question about a non-GlassFish-specific solution’s still unanswered. Any help would be greatly appreciated.

Be Sociable, Share!
This entry was posted in Java EE.

Leave a Reply

%d bloggers like this: