You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Xiaoshu Wang <wa...@musc.edu> on 2006/08/16 03:02:32 UTC

tapernate question

Hi, I am playing around Tapernate, which I have a question to ask.  It seems
that the exception thrown by a database query would not be able to be
catched at the application level.  For isnstance, I justed added a unique
constraints on the Message.value property.  If I ever try to created a
message that has a duplicated value with an existing Message, it break the
application.  I didn't find a way to catch the exception.  Is this expected
behavior or not?

Also, where I can find the source code for the HibernateService?

Thanks,

XW


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: tapernate question

Posted by James Carman <ja...@carmanconsulting.com>.
Yeah, I know about the new getCurrentSession() stuff.  It's just a matter of
me finding the time to sit down and write the stuff that I want.  As I said,
it shouldn't be that hard really.  Spring ORM does really save the code
required to enforce real TX demarcation, though (such as REQUIRES_NEW). 

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of hv @ Fashion Content
Sent: Saturday, August 19, 2006 9:00 AM
To: users@tapestry.apache.org
Subject: Re: tapernate question

SessionFactory has a getCurrentSession function now, and you can define a 
policy if you dont like the existing. All you need is a servlet filter to 
commit & close the current session. It's very few lines of code saved by 
using Spring ORM.

Henrik

"James Carman" <ja...@carmanconsulting.com> skrev i en meddelelse 
news:00c401c6c1e6$5aba8590$6a01a8c0@CARMANI9300...
> The main reason that I use the Spring stuff is for the transaction
> demarcation stuff.  Hibernate doesn't include anything "out-of-the-box" 
> that
> allows you to do "nested" transactions (i.e. REQUIRES_NEW).  You'd have to
> roll that yourself and Spring has already done that for me.  Although, I'm
> looking into just implementing it on my own, since it's really not that
> difficult to do (keep a stack around for your "current session").
>
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of hv @ Fashion Content
> Sent: Wednesday, August 16, 2006 3:35 PM
> To: users@tapestry.apache.org
> Subject: Re: tapernate question
>
> I had a similar concern with Trails, and made my own persistence service
> that uses Hibernate directly.
> With Hibernate 3.1 you don't really need the Spring ORM stuff.
>
> "Xiaoshu Wang" <wa...@musc.edu> skrev i en meddelelse
> news:000701c6c14d$14346b20$4a741780@bioxiao...
>> Thanks, James.
>>
>> I am able to get the exception now.  However, the exceptions seem to be
>> wrapped into spring's DataAccessException.  The original cause of
>> HibernateException is gone.  I tried to traverse the Exception track by
>> getCause(), but only get the DataIntegrityViolationException and
>> java.sql.BatchUpdateException.
>>
>> I am writing an application that has two fields that can violate the same
>> contraints.  The lost of HibernateException won't allow me to figure out
>> the
>> which field is duplicated.
>>
>> Xiaoshu
>>
>>> -----Original Message-----
>>> From: James Carman [mailto:james@carmanconsulting.com]
>>> Sent: Wednesday, August 16, 2006 6:05 AM
>>> To: 'Tapestry users'
>>> Subject: RE: tapernate question
>>>
>>> If you want more fine-grained control over what's going on,
>>> turn off transaction-per-request and use service methods with
>>> transaction interceptors on them to achieve what you want.
>>> The reason that you didn't get the exception is that the
>>> transaction isn't committing until the end of the request and
>>> that's when you'll get the unique constraint violation
>>> exception.  The exception presenter might not even catch
>>> this, come to think of it.  I actually changed the way
>>> Tapernate is implemented in my local copy.  I might need to
>>> push that out to the rest of you.
>>>
>>> -----Original Message-----
>>> From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
>>> Sent: Tuesday, August 15, 2006 9:45 PM
>>> To: 'Tapestry users'
>>> Subject: RE: tapernate question
>>>
>>> I tried to put something like
>>>
>>> try {
>>>   getSession.update(message);
>>> } catch (Throwable e) {
>>>    System.out.println("Catch it.");
>>> }
>>>
>>> under the MessageDaoImpl.update(Message), but it seems not
>>> doing anything.
>>>
>>> How to hook with ExceptionPresenter?
>>>
>>> Xiaoshu
>>>
>>>
>>> > -----Original Message-----
>>> > From: James Carman [mailto:james@carmanconsulting.com]
>>> > Sent: Tuesday, August 15, 2006 9:09 PM
>>> > To: 'Tapestry users'
>>> > Subject: RE: tapernate question
>>> >
>>> > You can put in a hook into the ExceptionPresenter or wrap your call
>>> > with a try/catch block.  The HibernateService class can be found at:
>>> >
>>> > http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src
>>> /main/java/com
>>> > /javaforge/hivemind/util/HiveMindService.java
>>> >
>>> > The username/password is anonymous/anon.
>>> >
>>> >
>>> > -----Original Message-----
>>> > From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
>>> > Sent: Tuesday, August 15, 2006 9:03 PM
>>> > To: users@tapestry.apache.org
>>> > Subject: tapernate question
>>> >
>>> > Hi, I am playing around Tapernate, which I have a question
>>> to ask.  It
>>> > seems that the exception thrown by a database query would
>>> not be able
>>> > to be catched at the application level.
>>> > For isnstance, I justed added a unique constraints on the
>>> > Message.value property.  If I ever try to created a message
>>> that has a
>>> > duplicated value with an existing Message, it break the
>>> application.
>>> > I didn't find a way to catch the exception.  Is this
>>> expected behavior
>>> > or not?
>>> >
>>> > Also, where I can find the source code for the HibernateService?
>>> >
>>> > Thanks,
>>> >
>>> > XW
>>> >
>>> >
>>> >
>>> ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>> >
>>> >
>>> >
>>> >
>>> ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>> >
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapernate question

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
SessionFactory has a getCurrentSession function now, and you can define a 
policy if you dont like the existing. All you need is a servlet filter to 
commit & close the current session. It's very few lines of code saved by 
using Spring ORM.

Henrik

"James Carman" <ja...@carmanconsulting.com> skrev i en meddelelse 
news:00c401c6c1e6$5aba8590$6a01a8c0@CARMANI9300...
> The main reason that I use the Spring stuff is for the transaction
> demarcation stuff.  Hibernate doesn't include anything "out-of-the-box" 
> that
> allows you to do "nested" transactions (i.e. REQUIRES_NEW).  You'd have to
> roll that yourself and Spring has already done that for me.  Although, I'm
> looking into just implementing it on my own, since it's really not that
> difficult to do (keep a stack around for your "current session").
>
> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of hv @ Fashion Content
> Sent: Wednesday, August 16, 2006 3:35 PM
> To: users@tapestry.apache.org
> Subject: Re: tapernate question
>
> I had a similar concern with Trails, and made my own persistence service
> that uses Hibernate directly.
> With Hibernate 3.1 you don't really need the Spring ORM stuff.
>
> "Xiaoshu Wang" <wa...@musc.edu> skrev i en meddelelse
> news:000701c6c14d$14346b20$4a741780@bioxiao...
>> Thanks, James.
>>
>> I am able to get the exception now.  However, the exceptions seem to be
>> wrapped into spring's DataAccessException.  The original cause of
>> HibernateException is gone.  I tried to traverse the Exception track by
>> getCause(), but only get the DataIntegrityViolationException and
>> java.sql.BatchUpdateException.
>>
>> I am writing an application that has two fields that can violate the same
>> contraints.  The lost of HibernateException won't allow me to figure out
>> the
>> which field is duplicated.
>>
>> Xiaoshu
>>
>>> -----Original Message-----
>>> From: James Carman [mailto:james@carmanconsulting.com]
>>> Sent: Wednesday, August 16, 2006 6:05 AM
>>> To: 'Tapestry users'
>>> Subject: RE: tapernate question
>>>
>>> If you want more fine-grained control over what's going on,
>>> turn off transaction-per-request and use service methods with
>>> transaction interceptors on them to achieve what you want.
>>> The reason that you didn't get the exception is that the
>>> transaction isn't committing until the end of the request and
>>> that's when you'll get the unique constraint violation
>>> exception.  The exception presenter might not even catch
>>> this, come to think of it.  I actually changed the way
>>> Tapernate is implemented in my local copy.  I might need to
>>> push that out to the rest of you.
>>>
>>> -----Original Message-----
>>> From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
>>> Sent: Tuesday, August 15, 2006 9:45 PM
>>> To: 'Tapestry users'
>>> Subject: RE: tapernate question
>>>
>>> I tried to put something like
>>>
>>> try {
>>>   getSession.update(message);
>>> } catch (Throwable e) {
>>>    System.out.println("Catch it.");
>>> }
>>>
>>> under the MessageDaoImpl.update(Message), but it seems not
>>> doing anything.
>>>
>>> How to hook with ExceptionPresenter?
>>>
>>> Xiaoshu
>>>
>>>
>>> > -----Original Message-----
>>> > From: James Carman [mailto:james@carmanconsulting.com]
>>> > Sent: Tuesday, August 15, 2006 9:09 PM
>>> > To: 'Tapestry users'
>>> > Subject: RE: tapernate question
>>> >
>>> > You can put in a hook into the ExceptionPresenter or wrap your call
>>> > with a try/catch block.  The HibernateService class can be found at:
>>> >
>>> > http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src
>>> /main/java/com
>>> > /javaforge/hivemind/util/HiveMindService.java
>>> >
>>> > The username/password is anonymous/anon.
>>> >
>>> >
>>> > -----Original Message-----
>>> > From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
>>> > Sent: Tuesday, August 15, 2006 9:03 PM
>>> > To: users@tapestry.apache.org
>>> > Subject: tapernate question
>>> >
>>> > Hi, I am playing around Tapernate, which I have a question
>>> to ask.  It
>>> > seems that the exception thrown by a database query would
>>> not be able
>>> > to be catched at the application level.
>>> > For isnstance, I justed added a unique constraints on the
>>> > Message.value property.  If I ever try to created a message
>>> that has a
>>> > duplicated value with an existing Message, it break the
>>> application.
>>> > I didn't find a way to catch the exception.  Is this
>>> expected behavior
>>> > or not?
>>> >
>>> > Also, where I can find the source code for the HibernateService?
>>> >
>>> > Thanks,
>>> >
>>> > XW
>>> >
>>> >
>>> >
>>> ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>> >
>>> >
>>> >
>>> >
>>> ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> > For additional commands, e-mail: users-help@tapestry.apache.org
>>> >
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: tapernate question

Posted by James Carman <ja...@carmanconsulting.com>.
The main reason that I use the Spring stuff is for the transaction
demarcation stuff.  Hibernate doesn't include anything "out-of-the-box" that
allows you to do "nested" transactions (i.e. REQUIRES_NEW).  You'd have to
roll that yourself and Spring has already done that for me.  Although, I'm
looking into just implementing it on my own, since it's really not that
difficult to do (keep a stack around for your "current session").

-----Original Message-----
From: news [mailto:news@sea.gmane.org] On Behalf Of hv @ Fashion Content
Sent: Wednesday, August 16, 2006 3:35 PM
To: users@tapestry.apache.org
Subject: Re: tapernate question

I had a similar concern with Trails, and made my own persistence service 
that uses Hibernate directly.
With Hibernate 3.1 you don't really need the Spring ORM stuff.

"Xiaoshu Wang" <wa...@musc.edu> skrev i en meddelelse 
news:000701c6c14d$14346b20$4a741780@bioxiao...
> Thanks, James.
>
> I am able to get the exception now.  However, the exceptions seem to be
> wrapped into spring's DataAccessException.  The original cause of
> HibernateException is gone.  I tried to traverse the Exception track by
> getCause(), but only get the DataIntegrityViolationException and
> java.sql.BatchUpdateException.
>
> I am writing an application that has two fields that can violate the same
> contraints.  The lost of HibernateException won't allow me to figure out 
> the
> which field is duplicated.
>
> Xiaoshu
>
>> -----Original Message-----
>> From: James Carman [mailto:james@carmanconsulting.com]
>> Sent: Wednesday, August 16, 2006 6:05 AM
>> To: 'Tapestry users'
>> Subject: RE: tapernate question
>>
>> If you want more fine-grained control over what's going on,
>> turn off transaction-per-request and use service methods with
>> transaction interceptors on them to achieve what you want.
>> The reason that you didn't get the exception is that the
>> transaction isn't committing until the end of the request and
>> that's when you'll get the unique constraint violation
>> exception.  The exception presenter might not even catch
>> this, come to think of it.  I actually changed the way
>> Tapernate is implemented in my local copy.  I might need to
>> push that out to the rest of you.
>>
>> -----Original Message-----
>> From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
>> Sent: Tuesday, August 15, 2006 9:45 PM
>> To: 'Tapestry users'
>> Subject: RE: tapernate question
>>
>> I tried to put something like
>>
>> try {
>>   getSession.update(message);
>> } catch (Throwable e) {
>>    System.out.println("Catch it.");
>> }
>>
>> under the MessageDaoImpl.update(Message), but it seems not
>> doing anything.
>>
>> How to hook with ExceptionPresenter?
>>
>> Xiaoshu
>>
>>
>> > -----Original Message-----
>> > From: James Carman [mailto:james@carmanconsulting.com]
>> > Sent: Tuesday, August 15, 2006 9:09 PM
>> > To: 'Tapestry users'
>> > Subject: RE: tapernate question
>> >
>> > You can put in a hook into the ExceptionPresenter or wrap your call
>> > with a try/catch block.  The HibernateService class can be found at:
>> >
>> > http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src
>> /main/java/com
>> > /javaforge/hivemind/util/HiveMindService.java
>> >
>> > The username/password is anonymous/anon.
>> >
>> >
>> > -----Original Message-----
>> > From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
>> > Sent: Tuesday, August 15, 2006 9:03 PM
>> > To: users@tapestry.apache.org
>> > Subject: tapernate question
>> >
>> > Hi, I am playing around Tapernate, which I have a question
>> to ask.  It
>> > seems that the exception thrown by a database query would
>> not be able
>> > to be catched at the application level.
>> > For isnstance, I justed added a unique constraints on the
>> > Message.value property.  If I ever try to created a message
>> that has a
>> > duplicated value with an existing Message, it break the
>> application.
>> > I didn't find a way to catch the exception.  Is this
>> expected behavior
>> > or not?
>> >
>> > Also, where I can find the source code for the HibernateService?
>> >
>> > Thanks,
>> >
>> > XW
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: tapernate question

Posted by "hv @ Fashion Content" <in...@fashioncontent.com>.
I had a similar concern with Trails, and made my own persistence service 
that uses Hibernate directly.
With Hibernate 3.1 you don't really need the Spring ORM stuff.

"Xiaoshu Wang" <wa...@musc.edu> skrev i en meddelelse 
news:000701c6c14d$14346b20$4a741780@bioxiao...
> Thanks, James.
>
> I am able to get the exception now.  However, the exceptions seem to be
> wrapped into spring's DataAccessException.  The original cause of
> HibernateException is gone.  I tried to traverse the Exception track by
> getCause(), but only get the DataIntegrityViolationException and
> java.sql.BatchUpdateException.
>
> I am writing an application that has two fields that can violate the same
> contraints.  The lost of HibernateException won't allow me to figure out 
> the
> which field is duplicated.
>
> Xiaoshu
>
>> -----Original Message-----
>> From: James Carman [mailto:james@carmanconsulting.com]
>> Sent: Wednesday, August 16, 2006 6:05 AM
>> To: 'Tapestry users'
>> Subject: RE: tapernate question
>>
>> If you want more fine-grained control over what's going on,
>> turn off transaction-per-request and use service methods with
>> transaction interceptors on them to achieve what you want.
>> The reason that you didn't get the exception is that the
>> transaction isn't committing until the end of the request and
>> that's when you'll get the unique constraint violation
>> exception.  The exception presenter might not even catch
>> this, come to think of it.  I actually changed the way
>> Tapernate is implemented in my local copy.  I might need to
>> push that out to the rest of you.
>>
>> -----Original Message-----
>> From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
>> Sent: Tuesday, August 15, 2006 9:45 PM
>> To: 'Tapestry users'
>> Subject: RE: tapernate question
>>
>> I tried to put something like
>>
>> try {
>>   getSession.update(message);
>> } catch (Throwable e) {
>>    System.out.println("Catch it.");
>> }
>>
>> under the MessageDaoImpl.update(Message), but it seems not
>> doing anything.
>>
>> How to hook with ExceptionPresenter?
>>
>> Xiaoshu
>>
>>
>> > -----Original Message-----
>> > From: James Carman [mailto:james@carmanconsulting.com]
>> > Sent: Tuesday, August 15, 2006 9:09 PM
>> > To: 'Tapestry users'
>> > Subject: RE: tapernate question
>> >
>> > You can put in a hook into the ExceptionPresenter or wrap your call
>> > with a try/catch block.  The HibernateService class can be found at:
>> >
>> > http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src
>> /main/java/com
>> > /javaforge/hivemind/util/HiveMindService.java
>> >
>> > The username/password is anonymous/anon.
>> >
>> >
>> > -----Original Message-----
>> > From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
>> > Sent: Tuesday, August 15, 2006 9:03 PM
>> > To: users@tapestry.apache.org
>> > Subject: tapernate question
>> >
>> > Hi, I am playing around Tapernate, which I have a question
>> to ask.  It
>> > seems that the exception thrown by a database query would
>> not be able
>> > to be catched at the application level.
>> > For isnstance, I justed added a unique constraints on the
>> > Message.value property.  If I ever try to created a message
>> that has a
>> > duplicated value with an existing Message, it break the
>> application.
>> > I didn't find a way to catch the exception.  Is this
>> expected behavior
>> > or not?
>> >
>> > Also, where I can find the source code for the HibernateService?
>> >
>> > Thanks,
>> >
>> > XW
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> > For additional commands, e-mail: users-help@tapestry.apache.org
>> >
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: tapernate question

Posted by James Carman <ja...@carmanconsulting.com>.
Hmmmm.  Well, that's the way Spring wraps it by default.  I don't have time
to look into it right now, but maybe you can check the Spring docs to see
what to do in your situation.  The Spring library is pretty thorough, so I
would imagine that there's something you can do.

James

-----Original Message-----
From: Xiaoshu Wang [mailto:wangxiao@musc.edu] 
Sent: Wednesday, August 16, 2006 12:00 PM
To: 'Tapestry users'
Subject: RE: tapernate question

Thanks, James.  

I am able to get the exception now.  However, the exceptions seem to be
wrapped into spring's DataAccessException.  The original cause of
HibernateException is gone.  I tried to traverse the Exception track by
getCause(), but only get the DataIntegrityViolationException and
java.sql.BatchUpdateException.

I am writing an application that has two fields that can violate the same
contraints.  The lost of HibernateException won't allow me to figure out the
which field is duplicated.

Xiaoshu

> -----Original Message-----
> From: James Carman [mailto:james@carmanconsulting.com] 
> Sent: Wednesday, August 16, 2006 6:05 AM
> To: 'Tapestry users'
> Subject: RE: tapernate question
> 
> If you want more fine-grained control over what's going on, 
> turn off transaction-per-request and use service methods with 
> transaction interceptors on them to achieve what you want.  
> The reason that you didn't get the exception is that the 
> transaction isn't committing until the end of the request and 
> that's when you'll get the unique constraint violation 
> exception.  The exception presenter might not even catch 
> this, come to think of it.  I actually changed the way 
> Tapernate is implemented in my local copy.  I might need to 
> push that out to the rest of you. 
> 
> -----Original Message-----
> From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
> Sent: Tuesday, August 15, 2006 9:45 PM
> To: 'Tapestry users'
> Subject: RE: tapernate question
> 
> I tried to put something like
> 
> try {
>   getSession.update(message);
> } catch (Throwable e) {
>    System.out.println("Catch it.");
> }
> 
> under the MessageDaoImpl.update(Message), but it seems not 
> doing anything.
> 
> How to hook with ExceptionPresenter? 
> 
> Xiaoshu
> 
> 
> > -----Original Message-----
> > From: James Carman [mailto:james@carmanconsulting.com]
> > Sent: Tuesday, August 15, 2006 9:09 PM
> > To: 'Tapestry users'
> > Subject: RE: tapernate question
> > 
> > You can put in a hook into the ExceptionPresenter or wrap your call 
> > with a try/catch block.  The HibernateService class can be found at:
> > 
> > http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src
> /main/java/com
> > /javaforge/hivemind/util/HiveMindService.java
> > 
> > The username/password is anonymous/anon.
> > 
> > 
> > -----Original Message-----
> > From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
> > Sent: Tuesday, August 15, 2006 9:03 PM
> > To: users@tapestry.apache.org
> > Subject: tapernate question
> > 
> > Hi, I am playing around Tapernate, which I have a question 
> to ask.  It 
> > seems that the exception thrown by a database query would 
> not be able 
> > to be catched at the application level.
> > For isnstance, I justed added a unique constraints on the 
> > Message.value property.  If I ever try to created a message 
> that has a 
> > duplicated value with an existing Message, it break the 
> application.  
> > I didn't find a way to catch the exception.  Is this 
> expected behavior 
> > or not?
> > 
> > Also, where I can find the source code for the HibernateService?
> > 
> > Thanks,
> > 
> > XW
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: tapernate question

Posted by Xiaoshu Wang <wa...@musc.edu>.
Thanks, James.  

I am able to get the exception now.  However, the exceptions seem to be
wrapped into spring's DataAccessException.  The original cause of
HibernateException is gone.  I tried to traverse the Exception track by
getCause(), but only get the DataIntegrityViolationException and
java.sql.BatchUpdateException.

I am writing an application that has two fields that can violate the same
contraints.  The lost of HibernateException won't allow me to figure out the
which field is duplicated.

Xiaoshu

> -----Original Message-----
> From: James Carman [mailto:james@carmanconsulting.com] 
> Sent: Wednesday, August 16, 2006 6:05 AM
> To: 'Tapestry users'
> Subject: RE: tapernate question
> 
> If you want more fine-grained control over what's going on, 
> turn off transaction-per-request and use service methods with 
> transaction interceptors on them to achieve what you want.  
> The reason that you didn't get the exception is that the 
> transaction isn't committing until the end of the request and 
> that's when you'll get the unique constraint violation 
> exception.  The exception presenter might not even catch 
> this, come to think of it.  I actually changed the way 
> Tapernate is implemented in my local copy.  I might need to 
> push that out to the rest of you. 
> 
> -----Original Message-----
> From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
> Sent: Tuesday, August 15, 2006 9:45 PM
> To: 'Tapestry users'
> Subject: RE: tapernate question
> 
> I tried to put something like
> 
> try {
>   getSession.update(message);
> } catch (Throwable e) {
>    System.out.println("Catch it.");
> }
> 
> under the MessageDaoImpl.update(Message), but it seems not 
> doing anything.
> 
> How to hook with ExceptionPresenter? 
> 
> Xiaoshu
> 
> 
> > -----Original Message-----
> > From: James Carman [mailto:james@carmanconsulting.com]
> > Sent: Tuesday, August 15, 2006 9:09 PM
> > To: 'Tapestry users'
> > Subject: RE: tapernate question
> > 
> > You can put in a hook into the ExceptionPresenter or wrap your call 
> > with a try/catch block.  The HibernateService class can be found at:
> > 
> > http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src
> /main/java/com
> > /javaforge/hivemind/util/HiveMindService.java
> > 
> > The username/password is anonymous/anon.
> > 
> > 
> > -----Original Message-----
> > From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
> > Sent: Tuesday, August 15, 2006 9:03 PM
> > To: users@tapestry.apache.org
> > Subject: tapernate question
> > 
> > Hi, I am playing around Tapernate, which I have a question 
> to ask.  It 
> > seems that the exception thrown by a database query would 
> not be able 
> > to be catched at the application level.
> > For isnstance, I justed added a unique constraints on the 
> > Message.value property.  If I ever try to created a message 
> that has a 
> > duplicated value with an existing Message, it break the 
> application.  
> > I didn't find a way to catch the exception.  Is this 
> expected behavior 
> > or not?
> > 
> > Also, where I can find the source code for the HibernateService?
> > 
> > Thanks,
> > 
> > XW
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> > 
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: tapernate question

Posted by James Carman <ja...@carmanconsulting.com>.
If you want more fine-grained control over what's going on, turn off
transaction-per-request and use service methods with transaction
interceptors on them to achieve what you want.  The reason that you didn't
get the exception is that the transaction isn't committing until the end of
the request and that's when you'll get the unique constraint violation
exception.  The exception presenter might not even catch this, come to think
of it.  I actually changed the way Tapernate is implemented in my local
copy.  I might need to push that out to the rest of you. 

-----Original Message-----
From: Xiaoshu Wang [mailto:wangxiao@musc.edu] 
Sent: Tuesday, August 15, 2006 9:45 PM
To: 'Tapestry users'
Subject: RE: tapernate question

I tried to put something like

try {
  getSession.update(message);
} catch (Throwable e) {
   System.out.println("Catch it.");
}

under the MessageDaoImpl.update(Message), but it seems not doing anything.

How to hook with ExceptionPresenter? 

Xiaoshu


> -----Original Message-----
> From: James Carman [mailto:james@carmanconsulting.com] 
> Sent: Tuesday, August 15, 2006 9:09 PM
> To: 'Tapestry users'
> Subject: RE: tapernate question
> 
> You can put in a hook into the ExceptionPresenter or wrap 
> your call with a try/catch block.  The HibernateService class 
> can be found at:
> 
> http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src
/main/java/com
> /javaforge/hivemind/util/HiveMindService.java
> 
> The username/password is anonymous/anon.
> 
> 
> -----Original Message-----
> From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
> Sent: Tuesday, August 15, 2006 9:03 PM
> To: users@tapestry.apache.org
> Subject: tapernate question
> 
> Hi, I am playing around Tapernate, which I have a question to 
> ask.  It seems that the exception thrown by a database query 
> would not be able to be catched at the application level.  
> For isnstance, I justed added a unique constraints on the 
> Message.value property.  If I ever try to created a message 
> that has a duplicated value with an existing Message, it 
> break the application.  I didn't find a way to catch the 
> exception.  Is this expected behavior or not?
> 
> Also, where I can find the source code for the HibernateService?
> 
> Thanks,
> 
> XW
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: tapernate question

Posted by Xiaoshu Wang <wa...@musc.edu>.
I tried to put something like

try {
  getSession.update(message);
} catch (Throwable e) {
   System.out.println("Catch it.");
}

under the MessageDaoImpl.update(Message), but it seems not doing anything.

How to hook with ExceptionPresenter? 

Xiaoshu


> -----Original Message-----
> From: James Carman [mailto:james@carmanconsulting.com] 
> Sent: Tuesday, August 15, 2006 9:09 PM
> To: 'Tapestry users'
> Subject: RE: tapernate question
> 
> You can put in a hook into the ExceptionPresenter or wrap 
> your call with a try/catch block.  The HibernateService class 
> can be found at:
> 
> http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src
/main/java/com
> /javaforge/hivemind/util/HiveMindService.java
> 
> The username/password is anonymous/anon.
> 
> 
> -----Original Message-----
> From: Xiaoshu Wang [mailto:wangxiao@musc.edu]
> Sent: Tuesday, August 15, 2006 9:03 PM
> To: users@tapestry.apache.org
> Subject: tapernate question
> 
> Hi, I am playing around Tapernate, which I have a question to 
> ask.  It seems that the exception thrown by a database query 
> would not be able to be catched at the application level.  
> For isnstance, I justed added a unique constraints on the 
> Message.value property.  If I ever try to created a message 
> that has a duplicated value with an existing Message, it 
> break the application.  I didn't find a way to catch the 
> exception.  Is this expected behavior or not?
> 
> Also, where I can find the source code for the HibernateService?
> 
> Thanks,
> 
> XW
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: tapernate question

Posted by James Carman <ja...@carmanconsulting.com>.
You can put in a hook into the ExceptionPresenter or wrap your call with a
try/catch block.  The HibernateService class can be found at:

http://svn.javaforge.com/svn/hivemind/hivemind-utils/trunk/src/main/java/com
/javaforge/hivemind/util/HiveMindService.java

The username/password is anonymous/anon.


-----Original Message-----
From: Xiaoshu Wang [mailto:wangxiao@musc.edu] 
Sent: Tuesday, August 15, 2006 9:03 PM
To: users@tapestry.apache.org
Subject: tapernate question

Hi, I am playing around Tapernate, which I have a question to ask.  It seems
that the exception thrown by a database query would not be able to be
catched at the application level.  For isnstance, I justed added a unique
constraints on the Message.value property.  If I ever try to created a
message that has a duplicated value with an existing Message, it break the
application.  I didn't find a way to catch the exception.  Is this expected
behavior or not?

Also, where I can find the source code for the HibernateService?

Thanks,

XW


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org