You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2011/04/20 21:14:44 UTC

JPA / method annotations

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
                .getMethodAnnotation(PersistenceContext.class);

        EntityManager em = JpaInternalUtils.getEntityManager(manager,
annotation);

        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
    {
        @Deprecated
        void foo();
    }

    public static class FooImpl
    {
        public void foo()
        {

        }
    }

    public static void main(String[] args) throws SecurityException,
NoSuchMethodException
    {
        System.out.println("Foo    : " +
Foo.class.getMethod("foo").getAnnotation(Deprecated.class));
        System.out.println("FooImpl: " +
FooImpl.class.getMethod("foo").getAnnotation(Deprecated.class));
    }
}

Output:

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
http://howardlewisship.com

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


Fwd: JPA / method annotations

Posted by Igor Drobiazko <ig...@gmail.com>.
---------- Forwarded message ----------
From: Igor Drobiazko <ig...@gmail.com>
Date: Wed, Apr 20, 2011 at 10:14 PM
Subject: Re: JPA / method annotations
To: Howard Lewis Ship <hl...@gmail.com>


I would hate to move away from copying annotation to proxies. It would
definitely break some of the existing apps. It would also a very big
limitation for creating integrations with libraries which need to read
annotations from classes. A good example a REST libs.

If I recall it correctly, when implementing the copying annotations with
Javassist there was an issue with the abstract class named
AbstractInvocation. It doesn't implement the getMethodAnnotation method
because it is generated somewhere. For components it is in
InternalClassTransformationImpl. I don't recall the place for the service
layer. Might it be the issue with plastic?

On Wed, Apr 20, 2011 at 9:14 PM, Howard Lewis Ship <hl...@gmail.com> wrote:

> 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
>                .getMethodAnnotation(PersistenceContext.class);
>
>        EntityManager em = JpaInternalUtils.getEntityManager(manager,
> annotation);
>
>        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
>    {
>        @Deprecated
>        void foo();
>    }
>
>    public static class FooImpl
>    {
>        public void foo()
>        {
>
>        }
>    }
>
>    public static void main(String[] args) throws SecurityException,
> NoSuchMethodException
>    {
>        System.out.println("Foo    : " +
> Foo.class.getMethod("foo").getAnnotation(Deprecated.class));
>        System.out.println("FooImpl: " +
> FooImpl.class.getMethod("foo").getAnnotation(Deprecated.class));
>    }
> }
>
> Output:
>
> 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
> http://howardlewisship.com
>



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Re: JPA / method annotations

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 20 Apr 2011 19:53:21 -0300, Igor Drobiazko  
<ig...@gmail.com> wrote:

> I think also tynamo guys rely on annotations being copied to proxies. I
> remember Alejandro Scandroli requested this feature.

This is a very important feature to make T-IoC services work with all  
other frameworks that uses annotations. IMHO, not having it is a serious  
T-IoC disadvantage when compared to other IoC containers.

-- 
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: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Fwd: JPA / method annotations

Posted by Howard Lewis Ship <hl...@gmail.com>.
---------- Forwarded message ----------
From: Howard Lewis Ship <hl...@gmail.com>
Date: Wed, Apr 20, 2011 at 3:59 PM
Subject: Re: JPA / method annotations
To: Igor Drobiazko <ig...@gmail.com>


May have to special-case building proxies with access to the
implementation class annotations.  I just did checkins that get
Tapestry JPA working correctly (with no change to tapestry-jpa) but
reworks the IoC layer to expose class and method annotations via the
AnnotationProvider interface, exposing annotations with priority from
the implementation class, then the service interface.

On Wed, Apr 20, 2011 at 3:53 PM, Igor Drobiazko
<ig...@gmail.com> wrote:
> In case of spring-integration I was using Tapestry IoC to build the routes.
> So, spring-integration was working on proxies.
>
> I think also tynamo guys rely on annotations being copied to proxies. I
> remember Alejandro Scandroli requested this feature.
>
> On Thu, Apr 21, 2011 at 12:43 AM, Howard Lewis Ship <hl...@gmail.com>
> wrote:
>>
>> Right, but how does that intersect with Tapestry IoC?  Anything that
>> scans the classpath for classes won't see any proxy classes, just the
>> original classes.
>>
>> On Wed, Apr 20, 2011 at 2:39 PM, Igor Drobiazko
>> <ig...@gmail.com> wrote:
>> > Any library which scans the classpath for their specific annotations
>> > fails
>> > while the annotations are lost. Here are some examples:
>> >
>> > http://download.oracle.com/javaee/5/api/javax/jws/WebService.html
>> > http://download.oracle.com/javaee/6/api/javax/ws/rs/Path.html
>> >
>> > In the past I had also a lot of problems integrating spring-integration
>> > into
>> > a Tapestry app.
>> >
>> > http://www.springsource.org/spring-integration
>> >
>> > If you want to use annotations to mark you services as routers, splitter
>> > transformers and endpoints, you are lost:
>> >
>> >
>> > http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Router.html
>> >
>> > http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Splitter.html
>> >
>> > http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Transformer.html
>> >
>> > The issue is that third party libraries need to read the annotations
>> > from
>> > classes. They just don't know what to do with ServiceResources.
>> >
>> > On Wed, Apr 20, 2011 at 10:46 PM, Howard Lewis Ship <hl...@gmail.com>
>> > wrote:
>> >>
>> >> Can you give me a specific example of the problem integrating with a
>> >> REST lib?  I'm trying to find where an interface point would exist
>> >> that has access to the proxy, but not to the ServiceResources object.
>> >>
>> >> On Wed, Apr 20, 2011 at 1:14 PM, Igor Drobiazko
>> >> <ig...@gmail.com> wrote:
>> >> > I would hate to move away from copying annotation to proxies. It
>> >> > would
>> >> > definitely break some of the existing apps. It would also a very big
>> >> > limitation for creating integrations with libraries which need to
>> >> > read
>> >> > annotations from classes. A good example a REST libs.
>> >> >
>> >> > If I recall it correctly, when implementing the copying annotations
>> >> > with
>> >> > Javassist there was an issue with the abstract class named
>> >> > AbstractInvocation. It doesn't implement the getMethodAnnotation
>> >> > method
>> >> > because it is generated somewhere. For components it is in
>> >> > InternalClassTransformationImpl. I don't recall the place for the
>> >> > service
>> >> > layer. Might it be the issue with plastic?
>> >> >
>> >> > On Wed, Apr 20, 2011 at 9:14 PM, Howard Lewis Ship <hl...@gmail.com>
>> >> > wrote:
>> >> >>
>> >> >> 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
>> >> >>                .getMethodAnnotation(PersistenceContext.class);
>> >> >>
>> >> >>        EntityManager em = JpaInternalUtils.getEntityManager(manager,
>> >> >> annotation);
>> >> >>
>> >> >>        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
>> >> >>    {
>> >> >>        @Deprecated
>> >> >>        void foo();
>> >> >>    }
>> >> >>
>> >> >>    public static class FooImpl
>> >> >>    {
>> >> >>        public void foo()
>> >> >>        {
>> >> >>
>> >> >>        }
>> >> >>    }
>> >> >>
>> >> >>    public static void main(String[] args) throws SecurityException,
>> >> >> NoSuchMethodException
>> >> >>    {
>> >> >>        System.out.println("Foo    : " +
>> >> >> Foo.class.getMethod("foo").getAnnotation(Deprecated.class));
>> >> >>        System.out.println("FooImpl: " +
>> >> >> FooImpl.class.getMethod("foo").getAnnotation(Deprecated.class));
>> >> >>    }
>> >> >> }
>> >> >>
>> >> >> Output:
>> >> >>
>> >> >> 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
>> >> >> http://howardlewisship.com
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > Best regards,
>> >> >
>> >> > Igor Drobiazko
>> >> > http://tapestry5.de
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> 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
>> >> http://howardlewisship.com
>> >
>> >
>> >
>> > --
>> > Best regards,
>> >
>> > Igor Drobiazko
>> > http://tapestry5.de
>> >
>>
>>
>>
>> --
>> 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
>> http://howardlewisship.com
>
>
>
> --
> Best regards,
>
> Igor Drobiazko
> http://tapestry5.de
>



--
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
http://howardlewisship.com



-- 
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
http://howardlewisship.com

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


Re: JPA / method annotations

Posted by Igor Drobiazko <ig...@gmail.com>.
In case of spring-integration I was using Tapestry IoC to build the routes.
So, spring-integration was working on proxies.

I think also tynamo guys rely on annotations being copied to proxies. I
remember Alejandro Scandroli requested this feature.

On Thu, Apr 21, 2011 at 12:43 AM, Howard Lewis Ship <hl...@gmail.com>wrote:

> Right, but how does that intersect with Tapestry IoC?  Anything that
> scans the classpath for classes won't see any proxy classes, just the
> original classes.
>
> On Wed, Apr 20, 2011 at 2:39 PM, Igor Drobiazko
> <ig...@gmail.com> wrote:
> > Any library which scans the classpath for their specific annotations
> fails
> > while the annotations are lost. Here are some examples:
> >
> > http://download.oracle.com/javaee/5/api/javax/jws/WebService.html
> > http://download.oracle.com/javaee/6/api/javax/ws/rs/Path.html
> >
> > In the past I had also a lot of problems integrating spring-integration
> into
> > a Tapestry app.
> >
> > http://www.springsource.org/spring-integration
> >
> > If you want to use annotations to mark you services as routers, splitter
> > transformers and endpoints, you are lost:
> >
> >
> http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Router.html
> >
> http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Splitter.html
> >
> http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Transformer.html
> >
> > The issue is that third party libraries need to read the annotations from
> > classes. They just don't know what to do with ServiceResources.
> >
> > On Wed, Apr 20, 2011 at 10:46 PM, Howard Lewis Ship <hl...@gmail.com>
> > wrote:
> >>
> >> Can you give me a specific example of the problem integrating with a
> >> REST lib?  I'm trying to find where an interface point would exist
> >> that has access to the proxy, but not to the ServiceResources object.
> >>
> >> On Wed, Apr 20, 2011 at 1:14 PM, Igor Drobiazko
> >> <ig...@gmail.com> wrote:
> >> > I would hate to move away from copying annotation to proxies. It would
> >> > definitely break some of the existing apps. It would also a very big
> >> > limitation for creating integrations with libraries which need to read
> >> > annotations from classes. A good example a REST libs.
> >> >
> >> > If I recall it correctly, when implementing the copying annotations
> with
> >> > Javassist there was an issue with the abstract class named
> >> > AbstractInvocation. It doesn't implement the getMethodAnnotation
> method
> >> > because it is generated somewhere. For components it is in
> >> > InternalClassTransformationImpl. I don't recall the place for the
> >> > service
> >> > layer. Might it be the issue with plastic?
> >> >
> >> > On Wed, Apr 20, 2011 at 9:14 PM, Howard Lewis Ship <hl...@gmail.com>
> >> > wrote:
> >> >>
> >> >> 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
> >> >>                .getMethodAnnotation(PersistenceContext.class);
> >> >>
> >> >>        EntityManager em = JpaInternalUtils.getEntityManager(manager,
> >> >> annotation);
> >> >>
> >> >>        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
> >> >>    {
> >> >>        @Deprecated
> >> >>        void foo();
> >> >>    }
> >> >>
> >> >>    public static class FooImpl
> >> >>    {
> >> >>        public void foo()
> >> >>        {
> >> >>
> >> >>        }
> >> >>    }
> >> >>
> >> >>    public static void main(String[] args) throws SecurityException,
> >> >> NoSuchMethodException
> >> >>    {
> >> >>        System.out.println("Foo    : " +
> >> >> Foo.class.getMethod("foo").getAnnotation(Deprecated.class));
> >> >>        System.out.println("FooImpl: " +
> >> >> FooImpl.class.getMethod("foo").getAnnotation(Deprecated.class));
> >> >>    }
> >> >> }
> >> >>
> >> >> Output:
> >> >>
> >> >> 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
> >> >> http://howardlewisship.com
> >> >
> >> >
> >> >
> >> > --
> >> > Best regards,
> >> >
> >> > Igor Drobiazko
> >> > http://tapestry5.de
> >> >
> >>
> >>
> >>
> >> --
> >> 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
> >> http://howardlewisship.com
> >
> >
> >
> > --
> > Best regards,
> >
> > Igor Drobiazko
> > http://tapestry5.de
> >
>
>
>
> --
> 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
> http://howardlewisship.com
>



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Re: JPA / method annotations

Posted by Howard Lewis Ship <hl...@gmail.com>.
Right, but how does that intersect with Tapestry IoC?  Anything that
scans the classpath for classes won't see any proxy classes, just the
original classes.

On Wed, Apr 20, 2011 at 2:39 PM, Igor Drobiazko
<ig...@gmail.com> wrote:
> Any library which scans the classpath for their specific annotations fails
> while the annotations are lost. Here are some examples:
>
> http://download.oracle.com/javaee/5/api/javax/jws/WebService.html
> http://download.oracle.com/javaee/6/api/javax/ws/rs/Path.html
>
> In the past I had also a lot of problems integrating spring-integration into
> a Tapestry app.
>
> http://www.springsource.org/spring-integration
>
> If you want to use annotations to mark you services as routers, splitter
> transformers and endpoints, you are lost:
>
> http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Router.html
> http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Splitter.html
> http://static.springsource.org/spring-integration/api/org/springframework/integration/annotation/Transformer.html
>
> The issue is that third party libraries need to read the annotations from
> classes. They just don't know what to do with ServiceResources.
>
> On Wed, Apr 20, 2011 at 10:46 PM, Howard Lewis Ship <hl...@gmail.com>
> wrote:
>>
>> Can you give me a specific example of the problem integrating with a
>> REST lib?  I'm trying to find where an interface point would exist
>> that has access to the proxy, but not to the ServiceResources object.
>>
>> On Wed, Apr 20, 2011 at 1:14 PM, Igor Drobiazko
>> <ig...@gmail.com> wrote:
>> > I would hate to move away from copying annotation to proxies. It would
>> > definitely break some of the existing apps. It would also a very big
>> > limitation for creating integrations with libraries which need to read
>> > annotations from classes. A good example a REST libs.
>> >
>> > If I recall it correctly, when implementing the copying annotations with
>> > Javassist there was an issue with the abstract class named
>> > AbstractInvocation. It doesn't implement the getMethodAnnotation method
>> > because it is generated somewhere. For components it is in
>> > InternalClassTransformationImpl. I don't recall the place for the
>> > service
>> > layer. Might it be the issue with plastic?
>> >
>> > On Wed, Apr 20, 2011 at 9:14 PM, Howard Lewis Ship <hl...@gmail.com>
>> > wrote:
>> >>
>> >> 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
>> >>                .getMethodAnnotation(PersistenceContext.class);
>> >>
>> >>        EntityManager em = JpaInternalUtils.getEntityManager(manager,
>> >> annotation);
>> >>
>> >>        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
>> >>    {
>> >>        @Deprecated
>> >>        void foo();
>> >>    }
>> >>
>> >>    public static class FooImpl
>> >>    {
>> >>        public void foo()
>> >>        {
>> >>
>> >>        }
>> >>    }
>> >>
>> >>    public static void main(String[] args) throws SecurityException,
>> >> NoSuchMethodException
>> >>    {
>> >>        System.out.println("Foo    : " +
>> >> Foo.class.getMethod("foo").getAnnotation(Deprecated.class));
>> >>        System.out.println("FooImpl: " +
>> >> FooImpl.class.getMethod("foo").getAnnotation(Deprecated.class));
>> >>    }
>> >> }
>> >>
>> >> Output:
>> >>
>> >> 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
>> >> http://howardlewisship.com
>> >
>> >
>> >
>> > --
>> > Best regards,
>> >
>> > Igor Drobiazko
>> > http://tapestry5.de
>> >
>>
>>
>>
>> --
>> 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
>> http://howardlewisship.com
>
>
>
> --
> Best regards,
>
> Igor Drobiazko
> http://tapestry5.de
>



-- 
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
http://howardlewisship.com

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