|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The client's view of a row in the house table. It
defines methods for the managed fields and any business methods
exposed from the HouseBean
implementation.
Clients always access the bean through the local interface. They never use the bean implementation. The separation between interface and implementation lets Resin-CMP insert its transaction and database caching code.
The home interface, HouseHome, is the main way to get instances of the House interface.
All local interfaces extend EJBLocalObject
.
Method Summary | |
void |
addPoints(int delta)
A business method to add points to the house. |
java.lang.String |
getName()
Returns the house name, which is the primary key of the bean. |
int |
getPoints()
Returns the number of points for the house. |
Methods inherited from interface javax.ejb.EJBLocalObject |
getEJBLocalHome, getPrimaryKey, isIdentical, remove |
Method Detail |
public java.lang.String getName() throws javax.ejb.EJBException
name
.
Local interfaces never define the setXXX
method for the primary key.
Local methods corresponding to container managed fields never throw checked exceptions, although they may throw runtime exceptions, like EJBException.
javax.ejb.EJBException
- if the transaction or the database access
fails. EJBException is a runtime exception.public int getPoints() throws javax.ejb.EJBException
points
.
The interface could also have exposed the
getPoints
method. This example keeps the setter
hidden to motivate the addPoints
business method.
javax.ejb.EJBException
- if the transaction or the database access
fails.public void addPoints(int delta)
Many updates will use business methods instead of setting the methods directly. By encapsulating the updates in business methods, applications can ensure the integrity of the database.
For example, the addPoints business method might also check the user's security and log any updates so a later audit can check who added points to the house.
delta
- the points to add or subtract from the house.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |