Yeah, that wouldn't fly in any of the apps that I work on. If you have
known constraints that the user is going to run into then you deal
with them in a friendly and helpful manner. Your end users aren't
going to find the generic tapestry error page friendly or helpful.

Josh

On Fri, Mar 14, 2008 at 10:27 AM, nicholas Krul <[EMAIL PROTECTED]> wrote:
> doesn't T5 autoflush the hibernate session at the end of the page render,
> though?
>
> so either the user will see a valid page (and the transaction committed in
> the database), or an error page (and no commits).
>
> I hope so, as I'm trusting to this.
>
> --nK
>
> On Fri, Mar 14, 2008 at 5:07 PM, Josh Canfield <[EMAIL PROTECTED]>
> wrote:
>
> > When you call session.save() your object is not necessarily getting
> > sent to the database, and thus database constraint violations may not
> > be thrown. If you want to ensure the object is sent to the database at
> > that point call session.flush() which "...is the process of
> > synchronizing the underlying persistent store with persistable state
> > held in memory."
> >
> > http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#flush()<http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#flush%28%29>
>
> >
> > Josh
> >
> > On Fri, Mar 14, 2008 at 2:17 AM, Angelo Chen <[EMAIL PROTECTED]>
> > wrote:
> > >
> > > Hi,
> > >
> > > Following code is trying to save a new record with an email which
> > already
> > > exists, after running, then try to update the same record in another
> > progam,
> > > I got:
> > >
> > > Lock wait timeout exceeded; try restarting transaction
> > >
> > > un comment out //sessionManager.Abort, above problem fixed. but I still
> > get
> > > this error in the log, looks like after abort, hibernate still trying to
> > > save:
> > >
> > > [ERROR] JDBCExceptionReporter Duplicate entry '[EMAIL PROTECTED]' for
> > key
> > > 2
> > > [INFO] TimingFilter Request time: 42 ms
> > > [ERROR] AssertionFailure an assertion failure occured (this may indicate
> > a
> > > bug in Hibernate, but is more likely due to unsafe use of the session)
> > > org.hibernate.AssertionFailure: null id in
> > org.bfe.istudio.t5.entities.Usr
> > > entry (don't flush the Session after an exception occurs)
> > >        at
> > > org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(
> > DefaultFlushEntityEventListener.java:55)
> > >        at
> > > org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(
> > DefaultFlushEntityEventListener.java:157)
> > >        ...
> > >
> > >
> > > @Inject private Session session;
> > >
> > > @Inject
> > > private HibernateSessionManager sessionManager;
> > >
> > > public void onActivate() {
> > >
> > > Usr usr = new Usr();
> > > usr.setName("123");
> > > usr.setEmail("[EMAIL PROTECTED]");
> > >
> > > try {
> > >        session.save(usr);
> > > } catch (HibernateException e) {
> > >        //sessionManager.abort();
> > > }
> > >
> > > <property name="hibernate.connection.autocommit">false</property>
> > >
> > >
> > > --
> > > View this message in context:
> > http://www.nabble.com/t5%3A-handling-of-hibernate-exceptions-tp16047005p16047005.html
> > > Sent from the Tapestry - User mailing list archive at Nabble.com.
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> >
> > --
> > --
> > TheDailyTube.com. Sign up and get the best new videos on the internet
> > delivered fresh to your inbox.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to