-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Eugene edited this page May 8, 2014
·
1 revision
How to use NoDTO:
- Download the jar from Dropbox location or check-out the project and compile it. There are Gradle and Maven scripts available.
- Put the library in your project or import it using Maven or Gradle
- Do something like following code snippet:
Example is based on GWT RemoteService
public UserService implements RemoteService {
//This is the Serialization Path:
private final static Set<String> SERIALIZATION_PATH = new HashSet<>(Arrays.asList("account", "account.address"));
private SerializationPreprocessor _serializationPreprocessor = new SerializationPreprocessor(
new HibernatePersistenceConfig(), // This tells no-dto what is your ORM library
new DefaultCodeStructureConfig() //This allows you to give no-dto hints on how you code
);
private UserDao _userDao;
public User load(Integer id) {
User user = _userDao.find(123);
return _serializationPreprocessor.prepare(user, SERIALIZATION_PATH).getEntity();
}
}