Skip to content
Model centric tools for Spring development Community portal
Skyway PerspectivesModel driven delivery

MyEclipse for Spring

Code Reference: GwtCustomer.java

The shared transfer type used by the GWT client. This page explains why it differs from the entity and how it is mapped.

Code assistant view showing generated Java types and model annotations
Figure 28. The transfer type carries only the fields the client needs.

GwtCustomer is the transfer type shared by the GWT client and the remote service. It is not the entity. It carries only the fields that the client screen needs, and it has no persistence annotations. That separation keeps the client contract stable when the data model changes.

Fields

  • id. The record key, or null for a new record.
  • name. The display name.
  • email. The contact address.
  • status. The current status value.

Mapping

The remote service maps between the entity and the transfer type. Keep the mapping in one place, usually a small converter class. A second mapping in the client drifts and produces screens that disagree with the server.

Serialization. The type must be serializable and must have a no argument constructor. Add fields carefully, because the client and the server are compiled separately and must agree on the contract.

The transfer type is generated from the model. Mark the fields that should reach the client so that the generator does not copy the whole entity. That keeps the payload small and the contract easy to explain.