tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject JPA / method annotations
Date Wed, 20 Apr 2011 19:14:44 GMT
Been struggling with this.  I must have screwed up the logic that
mixes-and-matches annotations from the implementation class with
annotations from the interface.

The problems with JPA are caused by this code from CommitAfterMethodAdvice:

    private EntityTransaction getTransaction(final Invocation invocation)
        final PersistenceContext annotation = invocation

        EntityManager em = JpaInternalUtils.getEntityManager(manager,

        if (em == null)
            return null;

        return em.getTransaction();

The annotation is always null.  Tracing with the debugger shows that
the method being invoked is a method on the Plastic Proxy class.

What I'm having trouble figuring out is why things worked when using
ClassFactory and not PlasticProxyFactory. Did I miss some code
somewhere that copied annotations from the interface into the proxy?
Normally, when you look at a method of a class, you see just the
annotations on that method, even if the method itself is an
implementation of an interface method that does have annotations:

public class Experiment
    public interface Foo
        void foo();

    public static class FooImpl
        public void foo()


    public static void main(String[] args) throws SecurityException,
        System.out.println("Foo    : " +
        System.out.println("FooImpl: " +


Foo    : @java.lang.Deprecated()
FooImpl: null

... I wonder if it is not too late to find a way to expose method
annotations via the AnnotationProvider interface; this would make it
much easier, as we already have AnnotationProvider and idea like
AnnotationProviderChain.  It would be very nice if we could move away
from copying annotation from one class to another.

Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210

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

View raw message