Kasia Lale dijo:
> Hi,
>
> I'm hoping somebody can point me in the right direction, please...
>
> I've been looking at Woody and the bean binding sample included in
> 2.1.(x), and wondering how i can synchronize the bean with the database,
> or at least what's the best way of doing this.

Check the OJB sample inside Cocoon distro.

>
>>From reading other posts, I'm thoroughly confused! Best I can figure,
>> the
> options are:
>
> * code the connection into the bean itself (or Helper class), using ctx
> lookup. [How can Helper class be Composable, or does Helper by-pass
> Avalon entirely, perhaps with direct jndi/j2ee datasource lookup?]

My current (maybe not the best, but working) solution:

1-Wrap all the DB using OJB with JDO. To make your life easy, use Druid
for that - http://druid.sf.net/

2-Write some Form Handler classes that manage the beans from/to Flow and
Database. In short they interact with the database. I think they can be
called brokers. But I am not sure. I wrote 1 Handler for every Woody form.
(Some forms can interact with more than 1 table at once --- master
details, etc.
3.Flow - is the controller: Create the bean and manage the request at top
level. Inside, the bean we call the "form-database handler" and woody.
4.Woody - View. Just get a bean, interact with the user and return the
bean to the flow.

That is all. I think we have a clean separation of concerns in this way.

> * use javascript such as database.js included in the petstore sample to
> get a DataSourceComponent/connection and update the bean to/from db in
> the (woody) flowscripts
>
> * use Actions (Composable) to lookup a DataSourceComponent and handle db
> interraction. How to reference the user's stored (continuation) bean
> instance data?
>
> Just for the record, I'm aware of the O/R mapping possibilities using
> OJB, and Hibernate, but think I need more basic understanding before
> potentially tackling these options. I've also read with interest how
> betwixt/castor can be used to output XML representation of a bean for
> Woody to bind to, but would still have to ask, how/where can db
> synchronization be handled?

OJB is very nice to do this work.

Cocoon has a built-in support for OJB. More info at:
http://wiki.cocoondev.org/Wiki.jsp?page=OJBBlock

Of course you are welcome in the quest.

Best Regards,

Antonio Gallardo




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

Reply via email to