return type of finder.

Discussions

EJB design: return type of finder.

  1. return type of finder. (2 messages)

    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.......

    Threaded Messages (2)

  2. return type of finder.[ Go to top ]

    Hi Raj,
    You can try checking number of records in the ResultSet if they are 0 then return null else the results
    Raj
  3. return type of finder.[ Go to top ]

    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.