Re: What should get method return types be??
"Rick Reumann" <[email protected]> Mon, 12 May 2003 12:05:44 -0400
| Newsgroups | gmane.comp.java.mvc.devel |
|---|---|
| Organization | baseBeans Engineering |
| Message-ID | <[email protected]> |
On Mon, 12 May 2003 11:36:17 -0400, Vic Cekvenich wrote:
> Regarding LabelBean, I do not think it ideal that Bean know any SQL, DAO
> should do SQL>
The LabelValueBean does not know any sql. It is BaseBean like all the
rest. The only difference is the LabelValueDAO methods can take an "ibatis
sql command" vs having those commands hard-coded into the DAO. For example
your CmntsDAO has
public void populateAll() throws Exception {
doRetrieve("CmntsSelectAll");
}
Whereas the LabelValueDAO has the signature
public void populateAll( String sqlCommand ) throws Exception {
doRetrieve(sqlCommand);
}
So maybe I wasn't clear the LabelValueBean has no SQL only the
LabelValueDAO has sql. The only difference is the LabelValueDAO is
reusable for various storage of label/value pairs.
> I am not sure wha your Setup Init Servlet idea is.... it does not look
> lyered. It looks like you are aching, but DAO does data cacing in Model
> layer, caching in Servlet is not ideal, IMO.
It's cool that the DAO takes care of the caching, but that's not really my
concern. My concern is where you would place commonly placed collections
for your application. Take, for instance, a common "States" collection
where you use this for select choices of stateAbbreivation and stateName.
For one, usually you are going to do some sort of form validation so at
the very least you'll need the list in session scope so that when you are
returned back to the page if validation fails, the drop down list will
still be there. Why also, load this type of collection into session scope
for each user's session when it's a collection that all user's will share?
So the question then is when/where to put this into application scope. My
idea was just put into scope on application start up, but if there is a
better place, just let me know. (Remember the collection in scope is just
your typical BaseBean object). It's not so much that I'm trying to 'cache'
the collection, but am trying to avoid having to mainting setting this
object into scope in a bunch of different places. When/where would you put
a BaseBean of States into some sort of scope?
--
Rick