hi ,
i'm using finder meathod ... suppose findxxx(), and i'm searching in the database on the basis of follwing keyword which i'm passing as a argument in the finder meathod .. but suppose if the keyword dosent exist in the database .... thats what is happening in my case ... whenever i used to execute that query that funtions dosent returns anything and the control finishes from there ....
but i want is that if the keyword dosent exist then it should return null to me .... can u tell me how can i do this that if the keyword dosent exist in the database then it should return null....
regards
Raj.......
-
return type of finder. (2 messages)
- Posted by: raj kumar
- Posted on: March 08 2004 05:13 EST
Threaded Messages (2)
- return type of finder. by Raj S on March 08 2004 09:57 EST
- return type of finder. by Paul Strack on March 08 2004 11:54 EST
-
return type of finder.[ Go to top ]
- Posted by: Raj S
- Posted on: March 08 2004 09:57 EST
- in response to raj kumar
Hi Raj,
You can try checking number of records in the ResultSet if they are 0 then return null else the results
Raj -
return type of finder.[ Go to top ]
- Posted by: Paul Strack
- Posted on: March 08 2004 11:54 EST
- in response to raj kumar
Write a finder that returns a collection of keywords. Then, if the keyword is not in the database, the finder can return an empty collection.
As a rule, nulls are evil and should be avoided if possible.