You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Thilo Tanner <tt...@astina.ch> on 2012/04/05 13:35:22 UTC
Tynamo Resteasy / JPA Integration
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tynamo Resteasy / JPA Integration
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Wed, 11 Apr 2012 05:02:25 -0300, Alejandro Scandroli
<al...@gmail.com> wrote:
> Hi Thilo
Hi, guys!
> 2) Even tough you do need an interface the @CommitAfter annotation
> could be in the implementation. This is the issue Thiago is talking
> about.
Correct. :)
> 3) The JAX-RS annotations need to be on the interface for RESTEasy to
> find them, I'm looking at this issue, this is not only a Tapestry
> issue is more related to how RESTEasy expects to find the annotations
> and how Plastic serves them. Maybe it's related to the previous point
> but I'm not sure.
It is. Tapestry-IoC advice works only in the proxies it creates for
interface-defined services.
--
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: Tynamo Resteasy / JPA Integration
Posted by Alejandro Scandroli <al...@gmail.com>.
Hi Thilo
There is three different things here:
1) To use the @CommitAfter annotation you are *always* going to need a
separate interface.
2) Even tough you do need an interface the @CommitAfter annotation
could be in the implementation. This is the issue Thiago is talking
about.
3) The JAX-RS annotations need to be on the interface for RESTEasy to
find them, I'm looking at this issue, this is not only a Tapestry
issue is more related to how RESTEasy expects to find the annotations
and how Plastic serves them. Maybe it's related to the previous point
but I'm not sure.
Cheers.
Alejandro.
On Wed, Apr 11, 2012 at 08:27, Thilo Tanner <tt...@astina.ch> wrote:
> Hi Thiago
>
> I agree. It would be great if your could file an issue. Sometimes it
> really makes no sense to separate an interface from the implementation
> or sometimes it would be handy to annotate the implementation instead
> of the interface. In case of JAX-RS, creating interfaces makes the
> code harder to read, because you need to go to the interface to see
> the web actions, paths etc.
>
> @POST
> @Consumes({"application/json", "text/xml"})
> @Produces({"application/json", "text/xml"})
> @CommitAfter
> public Response create(@Valid Label label);
>
>
> Kind regards
>
> Thilo
>
> On Tue, Apr 10, 2012 at 3:44 PM, Thiago H. de Paula Figueiredo
> <th...@gmail.com> wrote:
>> On Tue, 10 Apr 2012 05:44:13 -0300, Taha Hafeez Siddiqi
>> <ta...@gmail.com> wrote:
>>
>>> Hi
>>
>>
>> Hi!
>>
>>
>>> Advices (@commitafter) work on service interfaces. Also the annotation
>>> should be on the interface method not on the implementation.
>>
>>
>> I really dislike this fact (annotation in the interface method). I think
>> I'll file a JIRA if there isn't one.
>>
>> --
>> 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
>>
>
>
>
> --
> 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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tynamo Resteasy / JPA Integration
Posted by Thilo Tanner <tt...@astina.ch>.
Hi Thiago
I agree. It would be great if your could file an issue. Sometimes it
really makes no sense to separate an interface from the implementation
or sometimes it would be handy to annotate the implementation instead
of the interface. In case of JAX-RS, creating interfaces makes the
code harder to read, because you need to go to the interface to see
the web actions, paths etc.
@POST
@Consumes({"application/json", "text/xml"})
@Produces({"application/json", "text/xml"})
@CommitAfter
public Response create(@Valid Label label);
Kind regards
Thilo
On Tue, Apr 10, 2012 at 3:44 PM, Thiago H. de Paula Figueiredo
<th...@gmail.com> wrote:
> On Tue, 10 Apr 2012 05:44:13 -0300, Taha Hafeez Siddiqi
> <ta...@gmail.com> wrote:
>
>> Hi
>
>
> Hi!
>
>
>> Advices (@commitafter) work on service interfaces. Also the annotation
>> should be on the interface method not on the implementation.
>
>
> I really dislike this fact (annotation in the interface method). I think
> I'll file a JIRA if there isn't one.
>
> --
> 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
>
--
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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tynamo Resteasy / JPA Integration
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 10 Apr 2012 05:44:13 -0300, Taha Hafeez Siddiqi
<ta...@gmail.com> wrote:
> Hi
Hi!
> Advices (@commitafter) work on service interfaces. Also the annotation
> should be on the interface method not on the implementation.
I really dislike this fact (annotation in the interface method). I think
I'll file a JIRA if there isn't one.
--
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: tapestry.apache.org down / slow
Posted by "Wechsung, Wulf" <wu...@sap.com>.
Thanks for your reply. Yeah, the problem seems to be definitely on my end. When I go to the site via a webproxy it loads just fine. When I go via my local browser it tries to load "svn.apache.org" for whatever reason. Probably a DNS problem somewhere here in the network.
-----Original Message-----
From: Howard Lewis Ship [mailto:hlship@gmail.com]
Sent: Dienstag, 10. April 2012 20:14
To: Tapestry users
Subject: Re: tapestry.apache.org down / slow
It's been fine for me .... perhaps it has to do with the Twitter
component built into the page? Try disabling JS and seeing what
happens.
On Tue, Apr 10, 2012 at 5:34 AM, Wechsung, Wulf <wu...@sap.com> wrote:
> Hi Everyone,
>
> is it just a problem from my end or has tapestry.apache.org often been unavailable or very slow these past few weeks? I've got no problems accessing any other websites, besides tapestry.apache.org.
>
> Is there an offline version of the site available to download so that we could host the component reference and guides locally?
>
> Thanks and Kind regards,
> Wulf
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
--
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: tapestry.apache.org down / slow
Posted by Howard Lewis Ship <hl...@gmail.com>.
It's been fine for me .... perhaps it has to do with the Twitter
component built into the page? Try disabling JS and seeing what
happens.
On Tue, Apr 10, 2012 at 5:34 AM, Wechsung, Wulf <wu...@sap.com> wrote:
> Hi Everyone,
>
> is it just a problem from my end or has tapestry.apache.org often been unavailable or very slow these past few weeks? I've got no problems accessing any other websites, besides tapestry.apache.org.
>
> Is there an offline version of the site available to download so that we could host the component reference and guides locally?
>
> Thanks and Kind regards,
> Wulf
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
--
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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
tapestry.apache.org down / slow
Posted by "Wechsung, Wulf" <wu...@sap.com>.
Hi Everyone,
is it just a problem from my end or has tapestry.apache.org often been unavailable or very slow these past few weeks? I've got no problems accessing any other websites, besides tapestry.apache.org.
Is there an offline version of the site available to download so that we could host the component reference and guides locally?
Thanks and Kind regards,
Wulf
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tynamo Resteasy / JPA Integration
Posted by Thilo Tanner <tt...@astina.ch>.
Hi
Thanks a lot for your help! I extracted interfaces from the resource
classes and now it works as expected.
Kind regards and have a nice day!
Thilo
On Tue, Apr 10, 2012 at 10:44 AM, Taha Hafeez Siddiqi
<ta...@gmail.com> wrote:
> 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 <tt...@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
>> <al...@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 <tt...@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-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tynamo Resteasy / JPA Integration
Posted by Taha Hafeez Siddiqi <ta...@gmail.com>.
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 <tt...@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
> <al...@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 <tt...@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-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tynamo Resteasy / JPA Integration
Posted by Thilo Tanner <tt...@astina.ch>.
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
<al...@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 <tt...@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-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@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-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Tynamo Resteasy / JPA Integration
Posted by Alejandro Scandroli <al...@gmail.com>.
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 <tt...@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-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org