I have made some changes in my code and now hibernate throws updates but there is no explicit code for this.
The changes consist in modify the setters of the bean for prevent inserts string with blank values, example:
public class Project {
private String name;
public setName(String name){
name=org.apache.commons.lang.StringUtils.trimToNull(name);
this.name = name;
}
}
Now i've got a finder for looking up projects (but not updates just select¡¡), and when the Transaction is committing hibernate begin to throws updates (i can see in the log console).
// Code transaction
HibernateSessionRequestFilter{
public doFilter( ... ){
...
HibernateUtil.currentSession().beginTransaction();
chain.doFilter(request, response);
HibernateUtil.currentSession().getTransaction().commit();
...
}
}
Any explain??, i gues that when i'm finding projects Hibernate calls de setter methods so change the state of the bean if the name field was blank.
Thanks for your help.
|