Skip navigation links

Package net.sf.mmm.util.transferobject.api

Provides the API for transfer-objects.

See: Description

Package net.sf.mmm.util.transferobject.api Description

Provides the API for transfer-objects.

Transfer-object API

Provides the API and base classes for TransferObjects and utilities based on well-established concepts.
A PersistenceEntity often contains relations (see OneToOne, OneToMany ManyToOne , or ManyToMany). While a PersistenceEntity can make use of lazy loading this is not possible in TransferObject. Therefore you have to express which selection of your data model you want to transfer for services that load, save, update, delete or process data. If you would add all relations to your TransferObjects you might end up with one of the following problems: Hence you want to avoid using relations in the same way in your TransferObjects. To avoid a naive way of doing this, this package introduces DTO, ETO, and CTO.
Assume you have the following entities:

Now you could build the following TOs: Due to the lack of multi-inheritance in java, the latter case is a problem. Therefore you would have to duplicate the attributes from Address or ContactInfo (or both).
Therefore our recommendation is to solve this by creating the following TransferObjects: If you separate persistence entities from TransferObjects then Address and ContactInfo should be an interfaces that centralize the JavaDoc for the attributes via the getter methods. Your EntityTo (e.g. AddressEto) and PersistenceEntity (e.g. AddressEntity) then both implement that interface (e.g. Address).
Skip navigation links

Copyright © 2001–2014 mmm-Team. All rights reserved.