This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

NX: findByCriteria Method  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Ranch Hand
Posts: 555
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
author and jackaroo
Marshal Commander
Posts: 12218
278
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing this thread as the discussion seems to have moved here.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!