Hello Ted,

Friday, June 08, 2001, 3:30:31 PM, you wrote:

TH> Defining the SQL commands in struts-config.xml is definately a
TH> leap-forward (I missed link to the sample WAR at first, and 
TH> didn't see how you were implementing everything.)

It is very simple model. For every action can be defined list of
bean/factory mappings and at request processing phase Servlet scan
this mappings, create bean by specified factory for every mapping and
store this bean in request or session scope. Every bean definition
(in struts-config) focus on some factory family (for example JDBC
factories, Castor factories, etc.).
JDBC factories use simple mechanism to retrieve data - perform SQL
query, create bean of specified type and call special method for every
row -

 bean.populateFrom( ResultSet rs )

to fill bean with values from row.

TH> Though, if stay on this road, larger project swill have to start
TH> assembling their struts-config.xml from smaller files, as some 
TH> people do with their Applicaton Resource now. ;-)

My first idea was to split struts-config to 'standart' part and
bean-factory part with my definirions. But it is needed to insert
references to bean templates into action tags and it was main reason
to build all in one.

TH> The bean factory proposal seems excellent, and I'm going to try 
TH> and take a closer at it this weekend. 

TH> < http://www.sura.ru/~gonza/bean-factory/ >

I'l build next revision at Saturday and notify community about it
shortly.

TH> It's an exciting idea, and works well with the J2EE patterns I'm 
TH> using now. 

TH> Being able to define the various beans we need in XML could bring 
TH> a real productivity boost to a lot of Struts developers, myself 
TH> included. I'm also getting ready to do something about a code 
TH> generator, which could work well with a factory like this.

TH> Incidentally, getting this to work is a real testament of how
TH> easy Java app configuration can be. Edited two lines 
TH> in struts-config.xml and I'm up and running with some other 
TH> DBMS.

Yes. I change datasource definition and some SQL queries in
bean-templates - and all application is moved from MySQL to DB2.

TH> -- Ted Husted, Husted dot Com, Fairport NY USA.
TH> -- Custom Software ~ Technical Services.
TH> -- Tel 716 737-3463.
TH> -- http://www.husted.com/about/struts/

TH> Oleg V Alexeev wrote:
>> TH> Speaking of configuration issues, I've also played with the idea of
>> TH> loading SQL commands from a resource, so they could be changed and
>> TH> reloaded without restarting the application. It would also be easier to
>> TH> optimize command sets for different DBMS packages. Just wondering if
>> TH> anyone else has implemented a SQL command resource.
>> 
>> I already implement this as part of my bean generation framework. It
>> contains JDBC bean factories (for single row, for all rows from result
>> set, for window from the result set) and bean-templates (may be wrong
>> term, of course) in which SQL queries can be defined. At bean creation
>> process factory uses attributes, properties and parameters from
>> request (all needed for this bean=template) and conserves result in
>> session or request scope to display with jsp page.




-- 
Best regards,
 Oleg                            mailto:[EMAIL PROTECTED]


Reply via email to