You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by radone <Ra...@seznam.cz> on 2005/10/24 15:40:31 UTC
EWDWT book - question - makeCopy()
Hi,
I am reading book EnjoyWebDevelopmentWithTapestry - chapter about using
Hibernate in and I am curious why is after getting object from database
cloned?
after
UserAccount ua = session.load(UserAccount.class, id);
is object cloned and used cloned version.
return ua.makeCopy();
public UserAccount makeCopy(){
UserAccount u = new UserAccount();
u.setAddress(this.getAddress());
u.setEmail(this.getEmail());
u.setId(this.getId());
u.setName(this.getName());
u.setSurname(this.getSurname());
u.setUsername(this.getUsername());
return u;
}
Why do I need this? Why not to send original of the loaded object?
Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: EWDWT book - question - makeCopy()
Posted by Kent Tong <ke...@cpttm.org.mo>.
radone <RadimBurget <at> seznam.cz> writes:
> I am reading book EnjoyWebDevelopmentWithTapestry - chapter about using
> Hibernate in and I am curious why is after getting object from database
> cloned?
That was the approach I used in the tapestry v3 edition to maintain
a strict separation of db layer and domain layer. But as it requires
just too much work, later I started to advocate an easier approach
(returning the hibernate object to the domain layer). So, please
consult the tapestry v4 edition for the details.
--
Author of a book for learning Tapestry (http://www.agileskills2.org/EWDT)
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org