J2EE pattern for complex database searches
I am havin trouble finding a method for doing complex searches that I am happy with.
I have a table of "log entrys" - each "log entry" is composed of an "admin user", "action" and one or two "target" value objects, as well as a Timestamp.
The problem here is a user, through a JSP form, will want to run searches such as "Get me all logs for user X between time Y and time Z involoing action A".
What is the best way of encapsulating this between the Web Tier and the EJB tier (obviously, once it's in the EJB Tier, it's time to translate it into SQL in the DAO and send the query off to the database).
Is it as simple as having a "Search Criteria" class containing many constants (e.g. SEARCH_BY_USER_ID, SEARCH_BY_MIN_TIME) and each instance of search criteria holding a map (e.g. "SEARCH_BY_USER_ID" => "BDTURNE", "SEARCH_BY_MIN_TIME" => "21st August") - or is there a better / neater way of encapsulating this call ?
All ideas / suggesitons welcomed !
Cheers,
Ben Turner

