Sylvain Wallez wrote:
Hi,
Some people to which I demonstrated Woody and Flowscript asked me how we can directly map forms to a database.
no surprise here :-)
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.
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 have been thinking about the direct sql mapping on and off, the biggest problem I was able to identify (not solve) is that sql is not 'symmetric' in its load and save operations (while woody binding is)
with symmetric I mean for doing updates or inserts you can't just give a resultset back to the JDBC connection...
Yep. I hit to the same wall when thinking of this problem.
And here comes (Antonio, you'll be happy!!) OJB, which AFAIK can persist DynaBeans [1].
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!
Wow.
This would set asside the usage of the form.save(object) alltogether then?
Yes, but only in the case of direct mapping to the database. The current binding has to be used when there's an application data model.
I'm not into OJB enough to understand just how simple this simple mapping file would be, some example/hint might help understanding the usability...
Me neither, but I think this will be the itch that will make me scratch ;-)
What do you think?
I think it would make for a killer usage pattern for the easy-apps!
And it makes sense: the form-definition model is in fact to be seen as a 'class' definition of form-instances, no?
Exactly.
(maybe in stead of dynabeans you could abuse the opportunity to boost your bcel skills again ;-))
Mmmpf... I don't want to introduce stuff I would be the only one to understand ;-)
And using DynaBeans should be fairly easy compared to writing a BCEL code generator. Note also that JXPath already handles DynaBeans, which would make navigating a form using XPath expressions a breeze!
Sylvain
-- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com
