Now that I have the <timestamp> feature working....such that I catch the situation where someone has changed a record while a user had the page open -- I'm stuck trying to figure out how to catch that specific error.
In the following....I can't
throw StaleObjectStateException -- the code won't compile.
How do I handle this...basically, in my struts action class I want to distinguish the StaleObjectStateException and forward onto a different error page just for that error.
Lee
Code:
public String makePersistent(Metric metric) throws InfrastructureException, StaleObjectStateException
{
try {
HibernateUtil.getSession().saveOrUpdate(metric);
HibernateUtil.getSession().flush();
} catch (StaleObjectStateException se) {
throw StaleObjectStateException;
} catch (HibernateException ex) {
throw new InfrastructureException(ex);
} catch (Exception e) {
throw new InfrastructureException(e);
}
return metric.getMetricId().toString();
}