http://openejb.979440.n4.nabble.com/Possible-OPENEJB-Bug-with-Interceptors-td982087.html




________________________________
From: Mark Struberg <strub...@yahoo.de>
To: dev@openwebbeans.apache.org
Sent: Tue, May 11, 2010 9:22:11 AM
Subject: Re: Need to switch to subclassing?

I could not find this explicitly stated in the EJB spec neither - so maybe 
OpenEJB needs a fix too? :D

Nah, just like to know what the 299 spec intends. Such things should work the 
same in Weld, CanDI, OWB and all other JSR-299 containers. I bet there are only 
very few developers (users!) out there which would find a bug caused by such a 
behaviour.

So my main concern is not the behaviour itself, but that it's currently not 
really well defined how it should behave.

I'll post this also on the weld list to get a feeling what they expect it to do.

LieGrue,
strub

--- On Tue, 5/11/10, Gurkan Erdogdu <gurkanerdo...@yahoo.com> wrote:

> From: Gurkan Erdogdu <gurkanerdo...@yahoo.com>
> Subject: Re: Need to switch to subclassing?
> To: dev@openwebbeans.apache.org
> Date: Tuesday, May 11, 2010, 6:11 AM
> This will also not work on EJB
> containers. For example, in EJB Hello
> 
> @Interceptors(MyInterceptor.class)
> public Hello implemenet IHello{
> 
>       public void method1(){
>             method2();
>      }
> 
>       public void method2(){
>             .......
>      }
> }
> 
> @Local
> public interface IHello{
>      public void method1();
>      public void method2();
> }
> 
> main(){
>     IHello proxy = getting from intitial context
>     proxy.method1();
> }
> 
> 
> Calling method2() from method1() does not trigger
> interception. Interceptor is called ones when client calls
> method1() on bean proxy. You could try it on OpenEJB for
> example
> 
> Thanks;
> 
> Gurkan
> 
> 
> 
> ________________________________
> From: Mark Struberg <strub...@yahoo.de>
> To: dev@openwebbeans.apache.org
> Sent: Tue, May 11, 2010 8:30:15 AM
> Subject: Need to switch to subclassing?
> 
> Hi!
> 
> There is a subtle difference between implementing
> interceptors via proxy or via subclasses.
> 
> I have the following service which imports data from a
> legacy system into my db. Since commits are very performance
> intense, they should get imported in packages of 100. So
> I'll get 100 'Employees' from my legacy system and then call
> a @Transactional method to store them in my own database.
> 
> public void ImportService() {
>   public void importEmployee() {
>     List<LegacyEmployee> les;
>     while ((les =
> getNext100EmployeesFromLegacy()) != nul) {
>       importLegacyEmployees(le);
>     }
>   }
> 
>   @Transactional
>   protected
> importLegacyEmployees(List<LegacyEmployee> les) {
>     for (LegacyEmployee le: les) {
>       employeeService.store(le);
>     }
>   }
> }
> 
> This would actually _not_ when using proxies for the
> interceptor handling, because calling a method on an own
> class doesn't invoke the proxyhandler.
> 
> So is this expected to work?
> 
> Sure, I could easily move the importLegacyEmployees() to an
> own service, but that would infringe classic OOP heavily
> imo.
> 
> Gurkan, what does the spec say here, I did find nothing.
> The old spec explicitly mentioned that we need to use
> subclassing, but I cannot find this anymore.
> 
> LieGrue,
> strub
> 
> 

Reply via email to