The object i'm referring to is definitely being created by Guice, in fact, 
its being created via a Guice factory binding..., as I said, moving the 
binding from the AbstractModule to ServletModule without ANY other changes, 
and it results in the correct behavior. My understanding is that that would 
only specify the Scope for the object to be Scopes.Request which is fine 
for my case, so this is sort of a solved problem, but I'm trying to 
understand why, and if that's some sort of intended behavior. I'll put 
together a sample to post to show what i'm doing. 

On Thursday, November 21, 2013 6:43:00 AM UTC-8, Robert Voliva wrote:
>
> With Guice/Jersey, we've always had to inject a proxy/delegate class that 
> contains all our AOP annotated methods.  As Stephan said, Jersey resource 
> classes are already created/instrumented and Guice then no longer has the 
> opportunity to wrap it with its AOP functionality.
>
>
> On Thu, Nov 21, 2013 at 1:52 AM, Stephan Classen <[email protected]<javascript:>
> > wrote:
>
>> The @Transactional annotation uses aop method interception (see 
>> JpaLocalTxnInterceptor).
>> This means the annotation works only when all of the following is true:
>>   - The concrete instance was created by Guice and not by anybody else 
>> (other framework or calling new)
>>   - the annotated method is not private
>>   - the annotated method is not final
>>   - the annotated method is not static
>>
>> In your case I would suspect that maybe the instance was created by 
>> Jersey (and Jersey then passes the instance to Guice for member injection) 
>> and not by Guice itself.
>>
>> If this doesn't help you may need to post some code or reduce the problem 
>> to a minimal setup for further exploration.
>>
>> regards
>> Stephan
>>
>>
>>
>>
>> On 11/21/2013 12:35 AM, Armin Bahramshahry wrote:
>>
>>> Hi,
>>>
>>> I've setup Guice with Jersey, and the PersistFilter. Trying to use 
>>> @Transactional annotation, and it seems to be working if the object is 
>>> binded in the Singleton scope, or Request scope (from within the servlet 
>>> module binding); however, objects that are just binded with the basic 
>>> binding (none) they seem to have problem with @Transactional.
>>>
>>> Getting the EntityManager seem to work fine, etc, but nothing gets 
>>> committed.
>>>
>>> Simply moving the binding of the object from the AbstractModule to 
>>> ServletModule makes the @Transactional to work as expected. The 
>>> @Transactional seem to also work for all objects that are marked as 
>>> Singleton.
>>>
>>> Was wondering if this is an intended behavior or not, and if not, what 
>>> could be causing this?
>>>
>>> Regards,
>>> Armin
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "google-guice" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected] <javascript:>.
>>> To post to this group, send email to [email protected]<javascript:>
>>> .
>>> Visit this group at http://groups.google.com/group/google-guice.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "google-guice" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/google-guice.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to