Gurkan, I obviously DO call a method of a bean instance. So this scenario is perfectly valid from the spec perspective.
LieGrue, strub --- Gurkan Erdogdu <gurkanerdo...@yahoo.com> schrieb am Di, 11.5.2010: > Von: Gurkan Erdogdu <gurkanerdo...@yahoo.com> > Betreff: Re: Need to switch to subclassing? > An: dev@openwebbeans.apache.org > Datum: Dienstag, 11. Mai, 2010 08:00 Uhr > Not expected to work. For interceptor > working, you have to call method on bean instance. So, move > your method into other class (this must not be hard!) > > Spec. does not talk about anything about proxied or > subclassing. It is leaved to implementation choice. > > > 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 > >