Although this thread is old, I just happened to come across while trying to 
understands internals of guice @Transactional.

If class A has caller method that calls a public @Transactional method in 
it's own class, does Transactional really apply?
If class A has dependency injected of class B(Singleton), and if class A 
calls a public @Transactional method of class B, I believe Transaction is 
definitely applied. However, it seems that for above scenario(calling 
method of it's own class), I believe Transaction should not be applied. 
Could you please let me know if I am correct?


On Saturday, 7 December 2013 01:07:51 UTC+5:30, Armin Bahramshahry wrote:
>
> Thanks Stephan!
>
> On Thursday, December 5, 2013 12:56:35 PM UTC-8, scl wrote:
>>
>> So far I always bound the persistence in a ServletModule (don't knwo why, 
>> just never did it any other way).
>> But having read the entire persistence code at least twice I cannot 
>> remember anything about request scope.
>> The only piece of code related to the servlet extension is the 
>> PersistFilter which allows to have a unit of work span a request.
>> The transactional annotation should be independent of the unit of work 
>> (it starts its own if non is running at the time the annotated method is 
>> executed).
>>
>> Also the unit tests in the persist extension are bound in abstract 
>> modules and not in servlet modules.
>> So I don't think what you are seeing is expected behavior.
>>
>> What you could do is set a break point within the annotated method and 
>> check if the JpaLocalTxnInterceptor class is in the call stack.
>> If this is not the case then the aop interceptor has not picket up the 
>> annotation. Another breakpoint in the constructor would allow you to find 
>> out who is instantiating the object.
>>
>> Good luck in finding the root of this issue
>> Stephan
>>
>>
>> On 12/05/2013 05:36 PM, Armin Bahramshahry wrote:
>>
>> So is this behavior not expected?
>>
>> On Monday, November 25, 2013 9:34:51 AM UTC-8, Paul Bryan wrote: 
>>>
>>> Is moving its binding to the ServletModule implicitly changing the 
>>> binding's scope to request?
>>>
>> -- 
>> 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.
>>
>>
>>

-- 
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 https://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/2eb6700a-323a-4624-9482-e97f51ac3950%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to