Wednesday, January 18, 2006

How To use a finder method returning more than one row in an ejb-ql?

1) write the ejb -ql in the EJB Deployment Descriptor as like:

method: findByObjectArray
ejb-ql: select object(o) from table_nm o where o.seq_id_fk = ?1

2) in the CMP Local interface, declare the finder fn:

public java.util.Collection findByObjectArray(java.lang.Integer SeqId) throws javax.ejb.FinderException;

Using the finder method:

3) call the finder method on local home. Initialise the iterator and use this iterator to access all the rows returned.

Collection newCollect = ejbLocalHm.findByObjectArray(seq_id);
Iterator iter = newCollect.iterator();

pretty simple for those who know...

0 Comments:

Post a Comment

<< Home