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....
You can try checking number of records in the ResultSet if they are 0 then return null else the results
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.