I don't have Gurkan's experience in the spec, but this seems to be what
section 7.2 is all about.  When do you treat a method call as a "business
method invocation", and how does that affect things like Decorators and
Interceptor invocation.

The only wording that hints this shouldn't work when calling another method
inside the bean is "When the container invokes a method of a bean".

I do think there is a need for a subclassing approach, specifically for
dependent scoped objects that we can not proxy.

Sincerely,

Joe


On Tue, May 11, 2010 at 1:30 AM, Mark Struberg <strub...@yahoo.de> wrote:

> 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