Version 1

    The aim of this wiki is to explain the clustered EJB3 bean serializable requirements that a developer must be aware of.


    Clustered Session Beans (SLSB & SFSB)

    First of all, clustered EJB3 SLSBs or SFSBs do not need to implement Serializable. In fact, it's recommended that they don't. In the case of clustered SLSBs, no state replication occurs, so their instance variables do not even need to be Serializable. With clustered SFSBs though, the same serialization rules used for SFSB passivation apply to SFSB state replication. In other words, all non-transient instance variables that are not references to beans, sessions contexts or user transactions must be serializable, or null at replication time. For further information on the SFSB passivation (and by extension replication because in both cases the SFSB bean context needs to be serialized), please check section 4.2.1 of the EJB3 core specification.


    Clustered Entity Beans

    These only need to be marked Serializable if the clustered entity instances are to be passed by value as a detached object (e.g., through a remote interface). Otherwise, there's no need to mark them as Serializable.


    Seam Booking Examples

    Finally, please note that currently, clustered beans in Seam's Booking example implement Serializable but as mentioned above, there's no need to do that and in fact, it's not recommended.