You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Yohan Yudanara <yo...@gmail.com> on 2011/01/11 11:25:55 UTC

Re: T5.2 Need Advice on JDBC and Transaction Mgmt

I've try it and it's working. Thank you very much.
Now I can use JdbcTemplate and declarative transaction on my Tapestry
Service, so I can take advantage of T 5.2 service reload feature.
This is improving productivity a lot.

Thanks...

Best regards,
Yohan Yudanara



On Mon, Dec 13, 2010 at 8:32 AM, Yohan Yudanara <yo...@gmail.com>wrote:

> Thank you very much for your explanation and code sample, Mr. Christian
> Köberl
> I will try it.
>
> On Sun, Dec 12, 2010 at 10:34 PM, Christian Köberl
> <ta...@gmail.com> wrote:
> >
> >
> > Yohan Yudanara-2 wrote:
> >>
> >> So, in my conclusion (CMIIW), if I'm using JDBC instead of Hibernate,
> >> I'd better stick with service/dao in spring bean. Because in spring
> >> bean, I can use spring declarative transaction and also JdbcTemplate.
> >> If I want to use tapestry service instead of spring bean, I need to
> >> write code for accessing database (using JDBC) and managing
> >> transaction from scratch.
> >>
> >
> > No, that's not really true. You could use the advise out of my first post
> on
> > this thread and apply that to all your Tapestry services accessing the
> > database. You could do this by searching for an annotation - you can even
> > use the Spring @Transacational annotation but it's probably better to
> have
> > your own (since semantics won't be completely the same).
> >
> > Here's how the advisor could look like (see other post for
> > TransactionalAdvise).
> >
> > public interface TransactionAdvisor
> > {
> >    void addTransactionAdvice(MethodAdviceReceiver receiver);
> > }
> >
> > public class TransactionAdvisorImpl implements TransactionAdvisor
> > {
> >    private final PlatformTransactionManager manager; // this is the
> Spring
> > transaction manager
> >
> >    private final Map<Propagation, MethodAdvice> transactionalAdvises;
> >
> >    public TransactionAdvisorImpl (PlatformTransactionManager manager)
> >    {
> >        this.manager = manager;
> >
> >        transactionalAdvises = new HashMap<Propagation, MethodAdvice>();
> >        for (Propagation propagation : Propagation.values())
> >        {
> >                transactionalAdvises.put(propagation, new
> > TransactionalAdvise(manager, propagation.value()));
> >        }
> >    }
> >
> >    public void addTransactionAdvice(MethodAdviceReceiver receiver)
> >    {
> >        for (Method m : receiver.getInterface().getMethods())
> >        {
> >            Transactional txAnnotation =
> > m.getAnnotation(Transactional.class);
> >
> >            if (txAnnotation != null)
> >            {
> >                receiver.adviseMethod(m,
> > transactionalAdvises.get(txAnnotation.propagation()));
> >            }
> >        }
> >    }
> > }
> >
> > In your module you have to bind the services and advise your DAOs:
> >    @Match("*DAO")
> >    public static void adviseTransactions(TransactionAdvisor advisor,
> > MethodAdviceReceiver receiver)
> >    {
> >        advisor.addTransactionAdvice(receiver);
> >    }
> >
> > This advice method is configured to match against any service whose id
> ends
> > with "DAO", such as "PersonDAO".
> > --
> > View this message in context:
> http://tapestry-users.832.n2.nabble.com/T5-2-Need-Advice-on-JDBC-and-Transaction-Mgmt-tp5825768p5828294.html
> > Sent from the Tapestry Users mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>

Re: T5.2 Need Advice on JDBC and Transaction Mgmt

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 27 May 2011 23:10:35 -0300, iberck <ib...@gmail.com> wrote:

> Any plans for suppor live class reloading in spring beans?

No, as they're not instantiated by Tapestry-IoC.

-- 
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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


Re: T5.2 Need Advice on JDBC and Transaction Mgmt

Posted by iberck <ib...@gmail.com>.
Any plans for suppor live class reloading in spring beans?

Thanks in advance


--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-Need-Advice-on-JDBC-and-Transaction-Mgmt-tp3301388p4433969.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5.2 Need Advice on JDBC and Transaction Mgmt

Posted by iberck <ib...@gmail.com>.
I'm implementing this approach to have live class reloading with TapestryIoC
Services Annotated with spring's @Transactional, but I have a problem:

How can I implement this approach COMPLETE, my problem is when I define for
example @Transactional(readonly=true) or
@Transactional(rollbackfor=Exception.class) , how can I implement it ?

Thanks in advance


--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-2-Need-Advice-on-JDBC-and-Transaction-Mgmt-tp3301388p4433413.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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