I just did an OJB+Struts app.

I have a Command interface (not java interface, layer type interface) top 
model object which knows about the persistence mechanism. Individual 
commands are *not* dependent upon struts at all, but happen to have 
properties populated that match nicely to the FormBean defn's.

Commands know about OJB and the domain object model. They provide a means to 
manipulate the object model.

Struts Actions have access to the command interface via a factory (the 
particular factory I use is designed to hide whether the Command is a local 
or remote EJb SessionBean, but it works just as well for POJO's - in fact it 
was originally designed around POJO commands). The Action gets an instance 
of a command object, and populates properties onto it, the executes it.

The Command is designed so that any object in the domain model that it 
modifies is populated into the response as a transfer object (really it is 
the domain object, but once it is outside transaction context of OJB it is 
no longer "live" so is safe to pass back to clients). These are used by 
Struts to render stuff.

A typical Action merely grabs a Command, populates it, executes it, pulls 
values from the Results object and populates them into the Request or 
Session depending on how it is configured. i don't have it down to a 
declarative implementation yet (ie, i have to customize each Action) but I 
am completely sure I can refactor it down to a single Action implementation 
and a config file when i have time.

I have had a fair bit of success with this ( http://gifts.skife.org ) and it 
is basically my play-with-new-ideas project so am more than happy to share 
the source if you want to contact me privately about it.

-Brian


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to