Hi, in my application I've got users which have files. The UserVO has the following mapping:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "users")
public Set<Files> getFiles()
{
return this.files;
}
Then I have a HibernateDAO with the following update method:
public void update(T vo)
{
try
{
startTransaction();
getSession().clear();
getSession().update(vo);
closeTransaction();
}
catch (HibernateException e)
{
rollbackTransaction();
e.printStackTrace();
}
}
When some values of a user's file have changed, I want to update my file. Therefore I use:
daoFiles.update(file); // this uses the HibernateDAO update!
UserDAO daoUser = UserDAO.getInstance();
daoUser.update(user); //... also a HibernateDAO update
The file's changes are saved to the database then but if I want to display the files of a user, then I cannot the changes of the files because the old values were displayed. Only if I get the fileVO directly I can see the new values. So it seems that the userVO does not recognize the update of a file.
Does anybody know were the problem is?
Best wishes!
Benny