|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
example.cmp.select.HouseBean
Implementation class for the House bean.
CREATE TABLE select_house (
name VARCHAR(250) NOT NULL,
PRIMARY KEY(name)
);
HouseBean is abstract since it's taking advantage of container-managed persistence. Resin-CMP will create the implementation of the abstract methods.
HouseBean also takes advantage of the AbstractEntityBean implementation. AbstractEntityBean is just a stub EntityBean implementation with default methods to make life a little more sane for simple beans.
Constructor Summary | |
HouseBean()
|
Method Summary | |
abstract java.util.Collection |
ejbSelectAllBoys(House house)
Returns a Collection of String s of all
Student's names who are boys. |
java.util.List |
getAllBoyNamesSorted()
The business method to find the boys in this house. |
abstract java.lang.String |
getName()
Returns the name of the house. |
abstract java.util.Collection |
getStudentList()
returns a Collection of all Students living in this House
(CMR field). |
Constructor Detail |
public HouseBean()
Method Detail |
public abstract java.lang.String getName()
public abstract java.util.Collection getStudentList()
Collection
of all Students living in this House
(CMR field).public abstract java.util.Collection ejbSelectAllBoys(House house) throws javax.ejb.FinderException
Collection
of String
s of all
Student's names who are boys. Since the ejbSelect method can't be
exposed in the local interface, we need to add a business method
to return the names.
As the example shows, ejbSelect methods can return collections and values of any type storable in the database. In contrast, find methods must always return the local interface of entity beans.
The ORDER BY clause is a Resin-CMP extension to the EJB-QL spec.
A later version of the EJB spec will almost certainly contain
similar functionality.
SELECT student.name
FROM select_house house, IN(house.studentList) student
WHERE student.gender='Boy' AND house=?1
ORDER BY student.name
public java.util.List getAllBoyNamesSorted()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |