• Post Reply 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Implementing 'AND' and 'OR' logic in Find method.

 
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,

I�ve read a number of posts regarding the find mechanism and have ended up making myself more uncertain than before.

I�ve tried to make my database layer as generic as possible, therefore I written my find method to support searching of criteria against all fields, and limit the search to name/location within the GUI layer.

The doubt that I�ve got ringing in the back of my head is do we need to support logical �AND� and �OR� conditions. I�ve currently only implemented the �AND� condition, so any records must match criteria for all fields that are not null.

My reason for this is that I can not see a sensible (or simple) way of implementing the �OR� condition with the current find method signature, and from an application point of view it doesn�t make sense to me to support a search where you could allow the user to select a name of a hotel OR and location.

However one of my must requirements is :

Must allow the user to search data for all records, or for records where the name and/or location.


To me this requirement just means that the user can select :

  • Just the name
  • Just the location
  • Both name and location


  • Is this how you have interpreted the requirement? I�m trying to keep everything as simple as possible, and feel that the find method signature does enable the support of a complex search that you may find in a SQL database.

    Thanks

    Jason
    [ March 13, 2006: Message edited by: Jason Moors ]
     
    Ranch Hand
    Posts: 31
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Jason Moors:

    To me this requirement just means that the user can select :

  • Just the name
  • Just the location
  • Both name and location



  • That is it, do not overthink it.
     
    Jason Moors
    Ranch Hand
    Posts: 188
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks for the clarification!

    I'm really enjoying this assignment, and I'm doing my best to keep it simple! However sometimes I think Sun are playing mind games with the requirements, as one minute I think I clearly understand everything and the next minute I start second guessing myself!

    Jason.
     
    Ranch Hand
    Posts: 86
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi

    It was mentionned in my assignement that

    "It Must allow the user to search data for all records, or for records where the name and/or location..."

    I understand that the user can select :

    Just the name
    Just the location
    Both name and location

    is there anyone who passed the exam and implemented the search method as I understand it

    Best Regards
     
    author and jackaroo
    Posts: 12200
    280
    Mac IntelliJ IDE Firefox Browser Oracle C++ Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Mike,

    Many people have passed with that assumption.

    Regards, Andrew
     
    Ranch Hand
    Posts: 1847
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Just think of the implications otherwise.
    It would mean you would enter for example "name: Teddy, Location: Xanadu" and get all records where either the person is called Teddy OR the person is located in Xanadu.
    That's just not logical, you want persons called Teddy who live in Xanadu.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic