Placing Beans in the same package and using "protected" access doesn't help.
Remember, these are methods which must be called remotely -- they must sit
on the remote interface of Employer -- so they can NOT be protected, they
must be public.
-----Original Message-----
From: Sven van ´t Veer [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 18, 2001 10:52 AM
To: May Charles N
Subject: Re: CMP EJB pattern - suggestions please
I think I would go for this solution. You would have to set up a role
for this to work, however, the deployer of the sessionbean can use the
same role when deploying the session bean. You might also place both in
the same package and use protected access for the changeXXX methods.
> ---------------------
> 2) Remove setter methods from Employer's remote interface. Introduce
> corresponding changeXXX() methods for the attributes, like
> changeNumEmployees( int change ) and changeTotalEmployeeSalaries(
BigDecimal
> change ) on the remote interface. In Employee, call changeNumEmployees( 1
)
> and changeTotalEmployeeSalaries( mySalary ) on the Employer during
> ejbPostCreate(). Call changeNumEmployees( -1 ) and
> changeTotalEmployeeSalaries( mySalary.negate() ) on the Employer during
> ejbRemove(). During Employee's setMySalary(newSalary), call
> changeTotalEmployeeSalaries( newSalary.subtract(oldSalary) ) on the
> Employer.
>
> pro:
> -faster getter methods on Employer since values already calculated.
Provided
> ALL access to these fields is through the EJBs the values should always be
> correct.
>
> cons:
> -changeXXX methods on Employer's remote interface should ONLY be called by
> Employee. Do I have to set up roles to guarantee this restriction?
Otherwise
> any EJB (even a session bean) could call Employer's changeXXX methods and
> Employer's values would be incorrect from that point forward.
> -once the attribute values are wrong in the database (say, someone uses
SQL
> to alter the value directly in the database) then they are never
> recalculated so they will be wrong from that point forward.
*****************************************************************
DISCLAIMER: The information contained in this e-mail may be confidential
and is intended solely for the use of the named addressee. Access, copying
or re-use of the e-mail or any information contained therein by any other
person is not authorized. If you are not the intended recipient please
notify us immediately by returning the e-mail to the originator.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".