You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2003/11/02 13:52:37 UTC

Re: [RT] Direct Form->SQL mapping through OJB and DynaBeans

On Friday, October 31, 2003, at 03:25 PM, Sylvain Wallez wrote:

> Hi,
>
> Some people to which I demonstrated Woody and Flowscript asked me how 
> we can directly map forms to a database.
>
> Yeah, I know that architecturally having intermediate domain objects 
> is better, but it seems a bit overkill when what you need is just a 
> simple CRUD front-end to a database and have no additional logic.

I am about to write some of these ....

> Writing a SQL binding for forms seems a complicated beast to me (maybe 
> I'm wrong as I'm not very fluent in SQL), so I was thinking of using 
> tools that would to the dirty work for me.

I am using Hibernate

> And here comes (Antonio, you'll be happy!!) OJB, which AFAIK can 
> persist DynaBeans [1].

I still have not groked DynaBeans ... :(

> So what about adding a getBean() to the widget interface that would 
> return a DynaBean wrapper of the form widgets? A simple OJB mapping 
> file and voilĂ , persistant forms!
>
> What do you think?

Very cool .....

The approach I was going to explore ... was to start with a Hibernate 
Mapping file, then generate as much as possible from that ....

User.hbm.xml --> User Table using 
net.sf.hibernate.tool.hbm2ddl.SchemaExport
User.hbm.xml --> User.java using 
net.sf.hibernate.tool.hbm2java.CodeGenerator
User.hbm.xml --> UserFormModel.xml, using xslt
User.hbm.xml --> UserFormBinding.xml, using xslt

I have only attempted the first step so far, so do not know yet how 
realistic the rest of this is :)


regards Jeremy