JBoss.orgCommunity Documentation

Chapter 8. Serialization

8.1. Serialization of external types

Serialization on the ErraiBus supports serialization within the same scope and limitations as the default GWT RPC serialization rules. In order to expose your domain objects to the bus so they can be exported across the bus, you must annotate them with the org.jboss.errai.bus.server.annotations.ExposeEntity annotation. The presence of this annotation will cause Errai's GWT compiler extensions to generate marshall/demarshall stubs for the annotated objects at compile-time.

For example:

public class User implements java.io.Serializable {
  private int userId;

  public int getUserId() {
    return userId;

  public void setUserId(int userId) {
    this.userId = userId;


All exposed entities must follow Java Bean convensions, and must be in the classpath both at compile-time and at runtime. Compile-time access to the entities is required since the creation of the marshalling/demarshalling proxies involves code generation.

It may not be possible to annotate certain types you wish to expose to the bus for serialization if the entities are located in a third-party library that you do not maintain. As such, you can explicitly indicate in the configuration that you would like to have this entities made available by declaring them in the ErraiApp.properties of any module.