The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird 1.2.1 findByCriteria() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "URLyBird 1.2.1 findByCriteria()" Watch "URLyBird 1.2.1 findByCriteria()" New topic
Author

URLyBird 1.2.1 findByCriteria()

Ericsson Liu
Greenhorn

Joined: Sep 17, 2008
Posts: 21
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


SCJP SCJD SCWCD
Thomas Thevis
Ranch Hand

Joined: Sep 02, 2008
Posts: 87
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


SCJP 5.0, SCJD in progress
Ericsson Liu
Greenhorn

Joined: Sep 17, 2008
Posts: 21
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

Joined: Sep 02, 2008
Posts: 87
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

Joined: Sep 17, 2008
Posts: 21
Thanks for the heads up. I guess I will do some more checkings in my business logic now.
Thomas Thevis
Ranch Hand

Joined: Sep 02, 2008
Posts: 87
You're welcome
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: URLyBird 1.2.1 findByCriteria()
 
Similar Threads
Search
URLyBird 1.3.2 : find method ambiguos
URLyBird: What is "exactly match" in URLyBird?
Conflicting search requirements (URLyBird 1.1.3)
find method in B&S