Thanks Thiago!

I have it working for my tests in my DAOModule (no classes, just services
that are explicitly advised via @Match("prefix*")


Now I want to apply it to all my pages and components in my web module
using @Match("*").  It causes a recursion error since it sees the services
in the DAO module which are needed to create the transaction!

I could do this for all my pages and components:
@Match({ "Page1", "Page2", "Page3",...
"Component1","Component2","Component3"... })

But that smells bad.  Would that be your choice?

I could also do @Advise(serviceInterface = Page1.class) , but that's even
worse because @Advise only takes one class at a time.

What I kind of want is to advise all my pages and components.


One more thing:  When I have one of these Neo4J-backed domain objects
(let's say User.class), I might have something like this in a page:

@Property
private User theUser;

In my template, if I do ${theUser.firstName}, will the transactional advise
be applied to the automatically constructed getters and setters for that
property?





BTW My annotation looks like this:

package org.apache.tapestry5.neo4j.annotation;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static
org.apache.tapestry5.ioc.annotations.AnnotationUseContext.BEAN;
import static
org.apache.tapestry5.ioc.annotations.AnnotationUseContext.COMPONENT;
import static
org.apache.tapestry5.ioc.annotations.AnnotationUseContext.MIXIN;
import static
org.apache.tapestry5.ioc.annotations.AnnotationUseContext.PAGE;
import static
org.apache.tapestry5.ioc.annotations.AnnotationUseContext.SERVICE;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import org.apache.tapestry5.ioc.annotations.UseWith;

/**
 * Marks a method of a service (or a component method) as transactional: the
 * call will create a tx, invoke the method, and then should call
tx.success()
 * after invoking the method. Failure through exception will cause Neo4J to
abort the commit.
 *
 * @author djue
 *
 */
@Target({METHOD})
@Retention(RUNTIME)
@Documented
@UseWith({ COMPONENT, MIXIN, PAGE, SERVICE, BEAN })
public @interface Neo4JTransactional {

}








On Mon, Jan 13, 2014 at 6:35 AM, Thiago H de Paula Figueiredo <
thiag...@gmail.com> wrote:

> On Fri, 10 Jan 2014 23:01:50 -0200, Daniel Jue <teamp...@gmail.com> wrote:
>
>  Hello friends,
>>
>
>  The Question:
>> So does a custom Advise annotation seem like the right way to go?
>>
>
> Yes! Just remember that Tapestry-IoC 5.3 doesn't copy the annotations from
> service implementation and its methods to the service proxy, but that
> limitation was already fixed in 5.4. For 5.3, you'll need to put your
> annotation in the service interface.
>
> --
> Thiago H. de Paula Figueiredo
> Tapestry, Java and Hibernate consultant and developer
> http://machina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to