You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Samuel Cheung <sy...@gmail.com> on 2005/03/22 00:32:13 UTC
How to update a persistent property
Hi,
I have a persistent property in my tapestry application 'currentUser'.
But when I make changes of the currentUser and click the 'submit', the
value of the user did not get update sometimes. Initially, the right
values are displayed. But if I keep refreshing the page, sometime the
wrong value shows up, other time.
And this is the submit method of my form:
public void submit(IRequestCycle cycle) {
System.out.println ("Change property! ");
try {
User user= getCurrentUser();
UserDAO usdao = new UserDAO();
// assume user's properties have been updated thru Tapestry 's form.
usdao.makePersistent(user);
HibernateUtil.getSession().flush();
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
// try {
// HibernateUtil.closeSession();
// } catch (HibernateException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
Here is what I have in my page:
<property-specification name="currentUser" type="db.model.User"
persistent="yes" />
In my page class, I have this:
public abstract User getCurrentUser();
public abstract void setCurrentUser(User user);
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org