| 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
|
 |
 |
|
|
subject: URLyBird 1.2.1 findByCriteria()
|
|
|