• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

URLyBird 1.2.1 findByCriteria()

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a question regarding to the search method.

The javadoc of the DBAcess interface says:


But the specification requires an exact match:


The coding part is not an issue, just want to clarify the requirement. I
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first requirement is for the database layer. You have to implement a data access class implementing this interface. Therefore, you have to implement the methods as specified by the interface. The seoond requirement comes from the GUI or middle tier (depending on the design decision you choose). Therefore, these two do not have to match exactly. However, if you implement the method as specified in the interface your business method should not be a problem (as you stated yourself).
My suggestion would be to thing in different tiers or layers and develop them independently of each other.

Regards,
Thomas
 
Ericsson Liu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Thomas, I understand what you mean. The problem is that the database layer is more relaxed on the searching than the business layer. Even though I implement my business rule as exact match, when it comes to db layer, it will still return all the records that partially match the criteria. Unless I do some more checking on the returned result set.

cheers
 
Thomas Thevis
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Ericsson,

...when it comes to db layer, it will still return all the records that partially match the criteria. Unless I do some more checking on the returned result set.


Agreed. In my opinion the extra checks are business logic and should be performed by a business layer. The database layer delivers all partial matches and the business layer restricts them to exact matches.

Regards,
Thomas
 
Ericsson Liu
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the heads up. I guess I will do some more checkings in my business logic now.
 
Thomas Thevis
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
reply
    Bookmark Topic Watch Topic
  • New Topic