You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Alexander Kundirenko <ak...@gmail.com> on 2005/08/16 18:36:07 UTC

Re[2]: Interceptor for tapestry page

No, I can't. If I do so, each DAO with be it's OWN transaction. I need
ONE transaction for all DAOs used within formSubmit() page listener
Richard>Can you put interceptors on your DAO's instead of on your user interface
Richard>elements?

JK> I don't think pages are currently reachable as "beans" in the typical
JK> sense yet, but there are a number of ways to do this that I know of...

Yes! This is that I needed, thank you a lot!
Tapestry is really good for conributions now!

JK> 1) Write an enhancement worker (see tapestry.enhance.xml in
JK> distribution's framework/src/descriptor/META-INF) . This is a little
JK> bit harder than normal operations.

JK> 2) Write a (are u using hibernate?) hibernate session proxy service
JK> that you setup within hivemodule.xml. I think there is mention of this
JK> in the wiki, as well as someone out there who tried to do all the
JK> things you are trying. I don't actually use this implementation so I
JK> can't provide an opinion on it...

JK> If the above mentioned implementation doesn't work I can email you a
JK> hibernate hivemind service I wrote...

JK> jesse
JK> On 8/16/05, Alexander Kundirenko <ak...@gmail.com> wrote:
>> Hi All,
>> I'm using some DAOs in my form page and need to use them within ONE
transaction.
>> To do this I have to inject into page both DAOs and TransactionManager
>> and use routine:
>> 
>> try {
>>    tm.beginTransaction();
>>    dao1.save(smth);
>>    dao2.save(smthElse);
>>    tm.commit();
>> } catch (Throwable t) {
>>    ...
>> } finally {
>>   tm.closeTransaction();
>> }
>> 
>> When I worked with SpringWeb I used interceptors so my formSubmit()
>> controller's method was always wrapped with transaction. Are there any
>> possibilities to do the same with tapestry or any plans to implement
>> interceptors for pages?
>> F.e. it could look like:
>> 
>> public abstract class TransactableFormPage extends BasePage {
>>    public abstract IDao getFirstDao();
>>    public abstract IDao getSecondDao()
>> 
>>    public abstract IPersistable getFirst();
>>    public abstract IPersistable getSecond();
>> 
>>    @Intercepted("dao.transaction.TransactionInterceptor")
>>    public void formSubmit() {
>>        getFirstDao().save(getFirst());
>>        getSecodDao().save(getSecond());
>>    }
>> 
>> }
>> 
>> Thank you,
>>    Alex
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail:
>> tapestry-dev-help@jakarta.apache.org
>> 
>>

JK> ---------------------------------------------------------------------
JK> To unsubscribe, e-mail:
JK> tapestry-dev-unsubscribe@jakarta.apache.org
JK> For additional commands, e-mail:
JK> tapestry-dev-help@jakarta.apache.org



-- 
Best regards,
 Alexandr                            mailto:akundirenko@gmail.com

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


Re: Re[2]: Interceptor for tapestry page

Posted by Jesse Kuhnert <jk...@gmail.com>.
I wasn't sure if I read your meaning correctly or not, but Richards
post made the most sense....Try the http://hivetranse.sourceforge.net/
project first before rolling your own or using mine. It probably does
everything you want already....

j
On 8/16/05, Alexander Kundirenko <ak...@gmail.com> wrote:
> No, I can't. If I do so, each DAO with be it's OWN transaction. I need
> ONE transaction for all DAOs used within formSubmit() page listener
> Richard>Can you put interceptors on your DAO's instead of on your user interface
> Richard>elements?
> 
> JK> I don't think pages are currently reachable as "beans" in the typical
> JK> sense yet, but there are a number of ways to do this that I know of...
> 
> Yes! This is that I needed, thank you a lot!
> Tapestry is really good for conributions now!
> 
> JK> 1) Write an enhancement worker (see tapestry.enhance.xml in
> JK> distribution's framework/src/descriptor/META-INF) . This is a little
> JK> bit harder than normal operations.
> 
> JK> 2) Write a (are u using hibernate?) hibernate session proxy service
> JK> that you setup within hivemodule.xml. I think there is mention of this
> JK> in the wiki, as well as someone out there who tried to do all the
> JK> things you are trying. I don't actually use this implementation so I
> JK> can't provide an opinion on it...
> 
> JK> If the above mentioned implementation doesn't work I can email you a
> JK> hibernate hivemind service I wrote...
> 
> JK> jesse
> JK> On 8/16/05, Alexander Kundirenko <ak...@gmail.com> wrote:
> >> Hi All,
> >> I'm using some DAOs in my form page and need to use them within ONE
> transaction.
> >> To do this I have to inject into page both DAOs and TransactionManager
> >> and use routine:
> >>
> >> try {
> >>    tm.beginTransaction();
> >>    dao1.save(smth);
> >>    dao2.save(smthElse);
> >>    tm.commit();
> >> } catch (Throwable t) {
> >>    ...
> >> } finally {
> >>   tm.closeTransaction();
> >> }
> >>
> >> When I worked with SpringWeb I used interceptors so my formSubmit()
> >> controller's method was always wrapped with transaction. Are there any
> >> possibilities to do the same with tapestry or any plans to implement
> >> interceptors for pages?
> >> F.e. it could look like:
> >>
> >> public abstract class TransactableFormPage extends BasePage {
> >>    public abstract IDao getFirstDao();
> >>    public abstract IDao getSecondDao()
> >>
> >>    public abstract IPersistable getFirst();
> >>    public abstract IPersistable getSecond();
> >>
> >>    @Intercepted("dao.transaction.TransactionInterceptor")
> >>    public void formSubmit() {
> >>        getFirstDao().save(getFirst());
> >>        getSecodDao().save(getSecond());
> >>    }
> >>
> >> }
> >>
> >> Thank you,
> >>    Alex
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail:
> >> tapestry-dev-help@jakarta.apache.org
> >>
> >>
> 
> JK> ---------------------------------------------------------------------
> JK> To unsubscribe, e-mail:
> JK> tapestry-dev-unsubscribe@jakarta.apache.org
> JK> For additional commands, e-mail:
> JK> tapestry-dev-help@jakarta.apache.org
> 
> 
> 
> --
> Best regards,
>  Alexandr                            mailto:akundirenko@gmail.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 
>

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