Re: hibernate unnecceessary updates because of dirty checking
page 30 of MEAP v7,
Another issue to consider is dirty checking. Hibernate automatically detects state changes in order to
synchronize the updated state with the database. It's usually safe to return a different instance from the
getter method than the instance passed by Hibernate to the setter. Hibernate compares them by valuenot
by object identityto determine whether the attribute's persistent state needs to be updated. For example,
the following getter method doesn't result in unnecessary SQL UPDATEs:
// This is OK
public String getFirstname() {
return new String(firstname);
}
Message was edited by:
sivaramom Message was edited by:
sivaramom
|