[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Applying aspect in Facade EJB
|
Hi,
my 2 cents here
well, yes you can do it wiht ASpectJ..
But
why would you want to go thru the expensive process of obtaining a reference of an EJB (i am ASSUMING, reading the code, that since no particular parameters are passed to createLocalSearchBORef();the LOcalSearchBORef is always the same..) for the sole purpose of removing it at the end of the method?
hth
marco
On 2/13/07, Rafael Martony <rmartony@xxxxxxxxx> wrote:
Hi everyone, I'm new to aspects and I'm trying to apply this exciting technology in our project.
I have a Facade EJB that contains several methods like these:
public List<XXXX> findXXXX(SearchCriteria searchCriteria, SortCriteria sortCriteria) throws BusinessException, RuleValidationException {
LocalSearchBO localSearchBORef = null;
try {
localSearchBORef = createLocalSearchBORef(); // obtains a local EJB reference
return localSearchBORef.findKeyXXXX(searchCriteria, sortCriteria);
} finally {
removeEJB(localSearchBORef);
}
}
I want to write an aspect to eliminate the need of writing of removeEJB (and the try-finally sentences) on every method.
Is it possible to do that with an aspect?
One possibility is to define localSearchBORef in the class having synchronized access to that field. But I think there's a better solution.
Any help would be appreciated, regards,
Rafael.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users