Hi

Advices (@commitafter) work on service interfaces. Also the annotation should 
be on the interface method not on the implementation.

Hope it helps
Sent from my iPhone

On Apr 10, 2012, at 1:58 PM, Thilo Tanner <ttan...@astina.ch> wrote:

> Hi Alejandro,
> 
> thanks a lot for the hint. I refactored our code according to the docs
> provided. The problem is, that the @CommitAfter is still not triggered
> by the JPA module. Our module looks like this:
> 
> public class RestModule
> {
>    public static void bind(ServiceBinder binder)
>    {
>        // REST resources
>        binder.bind(BookmarkResource.class);
>        ...
>    }
> 
>    @Contribute(javax.ws.rs.core.Application.class)
>    public static void configureRestResources(Configuration<Object> singletons,
>                                              ActivityResource 
> activityResource,
>                                              BookmarkResource 
> bookmarkResource,
>                                              ...)
>    {
>        singletons.add(bookmarkResource);
>        ...
>    }
> 
>    @Match("*Resource")
>    public static void adviseTransactionally(JpaTransactionAdvisor advisor,
>                                             MethodAdviceReceiver receiver)
>    {
>        advisor.addTransactionCommitAdvice(receiver);
>    }
> }
> 
> Does anyone know, why the advising of our resource classes doesn't
> work? I debugged the code and the advise method of
> CommitAfterMethodAdvice is never called. Is it necessary to use
> interfaces?
> 
> Thanks a lot in advance!
> 
> Kind regards
> 
> Thilo
> 
> On Sat, Apr 7, 2012 at 12:14 AM, Alejandro Scandroli
> <alejandroscandr...@gmail.com> wrote:
>> Hey Thilo
>> 
>> You don't have to use the autobuild feature if you don't want to.
>> Declare your resteasy resources as normal Tapestry IoC services and
>> then contribute them to the javax.ws.rs.core.Application.
>> Here is an example from then tapestry-resteasy guide:
>> 
>> @Contribute(javax.ws.rs.core.Application.class)
>> public static void configureRestResources(Configuration<Object>
>> singletons, ReloadableEchoResource reloadableEchoResource)
>> {
>>        singletons.add(reloadableEchoResource);
>> }
>> 
>> BTW,  remember NOT to put this service in the autodiscovery package.
>> 
>> Check the guide, specially the Live class reloading part.
>> http://tynamo.org/tapestry-resteasy+guide#tapestry-resteasyguide-Liveclassreloading
>> 
>> Cheers.
>> Alejandro.
>> 
>> 
>> On Thu, Apr 5, 2012 at 13:35, Thilo Tanner <ttan...@astina.ch> wrote:
>>> Dear Tapestry Users
>>> 
>>> We would like to integrate Tynamo's Resteasy module with the JPA
>>> module (from Tapestry with Hibernate 4). The problem is, that we
>>> cannot advise Tapestry to observe the @CommitAfter annotations for the
>>> web service resources. The following doesn't work:
>>> 
>>> @Match("*Resource")
>>> public static void adviseTransactions(HibernateTransactionAdvisor
>>> advisor, MethodAdviceReceiver receiver)
>>> {
>>>        advisor.addTransactionCommitAdvice(receiver);
>>> }
>>> 
>>> The Resteasy module uses the autobuild() method to create singletons
>>> of the resource classes (without having interfaces).
>>> 
>>> Is it not possible to advise a service which has no interface?
>>> 
>>> Is there may be a better way integrate JPA with Resteasy?
>>> 
>>> Thanks in advance for your help!
>>> 
>>> Kind regards and happy easter
>>> 
>>> Thilo
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>> 
> 
> 
> 
> -- 
> Thilo Tanner
> 
> Astina AG
> Hardturmstrasse 105
> CH-8005 Zürich
> 
> Phone:  +41 44 500 77 10
> Fax:    +41 44 500 77 11
> Direct: +41 44 500 77 16
> Mobile: +41 79 506 46 36
> 
> Web:    http://www.astina.ch
> 
> ***
> Diese Mitteilung ist nur fuer die Empfaengerin / den Empfaenger
> bestimmt und kann vertrauliche Informationen enthalten. Fuer den Fall,
> dass sie von nicht berechtigten Personen empfangen wird, bitten wir
> diese hoeflich, die Mitteilung an Astina zurueckzusenden und
> anschliessend
> die Mitteilung mit allen Anhaengen sowie allfaellige Kopien zu
> vernichten bzw. zu loeschen. Der Gebrauch der Information ist verboten.
> 
> This message is intended only for the named recipient and may contain
> confidential or privileged information. If you have received it in
> error, please advise the sender or Astina by return e-mail and delete
> this message and any attachments. Any unauthorised use or dissemination
> of this information is strictly prohibited.
> ***
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
> 

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

Reply via email to