The solution is to pass only the fields we need in Views of the User. to do so we do the following
<property name="views.pkg" value="org.ephman.examples.user.views"/>
<class name="${user.pkg}.User" ... >
<class-view name="${views.pkg}.UserQuickView"
format="quick" />
...
<field name="userId" type="string">
<view in="quick"/>
</field>
...
</class>
This will generate a class representing an abstraction of the class
User, which has the field userId. ALSO a routine
will be added to User called createQuickView (). This routine
operates on this and returns a UserQuickView with
userId set to the same value in the User object. Also you can create
a new User with a UserQuickView as the initialization parameters
(ie. from a new User form).
UserQuickView initUser -> passed in from a separate service.. User newUser = new User (); newUser.initializeFromView (initUser);