cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject Re: SQL Editor
Date Mon, 03 Feb 2003 14:28:41 GMT
Jeremy Quinn wrote:
> Hi Guys
> 
> I am looking into implementing a forms-based editor for a complex set of 
> inter-related SQL Tables (with lots of gruesome link tables etc.).
> 
> What is currently considered the best technique to be using in Cocoon 
> right now?
> 
> XMLForm (we don't use Beans)
> OriginalDBActions (obsolete ? )
> ModularDBActions (Actions are not liked by many)
> SQL Inserts/Updates using SQLTransformer (maybe not capable of the job 
> due to complexities of the multiple Table updating required ? )
> SQL Inserts/Updates using ESQL TagLib (complex and difficult to maintain 
> ? )
> OutputModules+FlowScript (too unknown ? )

XMLForm + FlowScript + some persistence framework.

If you don't use beans for your business entities, you should ;-). The 
application I'm currently working on uses Hibernate for mapping objects 
to an RDBMS, Flow for the application flow control and XMLForm for data 
entry and validation.

It goes something like this (this is a flowscript fragment for 
retrieving a business entity, having "id" as it's POID [1], into a bean, 
associating it with a form, posting it to the user, awaiting submission, 
validating and storing):

session = sessionFactory.openSession();
var entity = new BusinessEntity();
session.load(entity, id);
session.close();
var form = getForm("entity-form", entity, 
"context://flows/workflow-schema.xml");
while (true) {
   form.save(cocoon.environment.getObjectModel(), "request");
   sendPageAndWait("entity-form", {});
   form.populate(cocoon.environment.getObjectModel());
   form.validate("phase");
   if (form.getViolations() != null && form.getViolations().size() > 0) {
     continue;
   }
   break;
}
session = sessionFactory.openSession();
session.saveOrUpdate(entity);
session.flush();
session.close();

IMHO, you can't beat the elegance and clarity of this approach.

	Ugo

-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message