permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: findByCriteria Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply locked New topic
Author

NX: findByCriteria Method

Dirk Band
Greenhorn

Joined: Jun 16, 2003
Posts: 8
Hi,
I have some concerns about the implementation of the �public long[] fingByCriteria(String[] criteria)� method.
The Assignment says:
It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
Should it by possible to serach for records where name AND location match and where name OR location match? But then, how to implement this in the findByCriteriaMethod? There is no parameter for the binding AND OR.
Vlad Rabkin
Ranch Hand

Joined: Jul 07, 2003
Posts: 555
Hi Dirk,
Here is discussion thread:
http://www.coderanch.com/t/183896/java-developer-SCJD/certification/URLBird-find-Hotel-or-Name
You will find an answer there.
Regards,
Vlad
Dirk Band
Greenhorn

Joined: Jun 16, 2003
Posts: 8
Thanks for this quick answer. I read it.
But my assignment says:
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public long[] findByCriteria(String[] criteria);
I understand that criteria[0] is the first database field. In my case it's name.
criteria[1] is second database field (location). and so on.
Example: findByCriteria({"Fred","Dallas","80$","",""})
Am I rigth?
Cheers Dirk
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Closing this thread as the discussion seems to have moved here.


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NX: findByCriteria Method
 
Similar Threads
AND or OR in search criteria
the search method
NX:Question about searching
B&S: findByCriteria - pls review
findByCriteria --- and --- or