Can someone explain in detail the different steps involved in adding 'finder' methods other than 'findByPrimaryKey' in IBM's VisualAge for Java?
Created May 4, 2012
Badri Kuppa You can create finder methods in the Home Interface and give an SQL hint in the finderHelper class. For example if you want to create a finder method for userId then the method in the home interface would be like this.
ObjectToBeReturned findByUserId(String userId) throws java.rmi.RemoteException, javax.ejb.FinderException;
then in the finder helper class you can put this line..
public final static String findByUserIdWhereClause = "USERID = ?";
Remember, the String declaration in finderHelper class should be as above, i.e.,
findBy+toBeFound+whereClauseyou can replace the where clause by a select statement too!
I hope this helps you!
--Badri bkuppa@usa.net