Win a copy of Spring in Action (5th edition) this week in the Spring forum!
    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:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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
Posts: 12195
279
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.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!