You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Sylvain Wallez <sy...@apache.org> on 2003/10/31 16:25:17 UTC
[RT] Direct Form->SQL mapping through OJB and DynaBeans
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.
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.
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!
What do you think?
Sylvain
[1]
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/DynaBean.html
--
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
Re: [RT] Direct Form->SQL mapping through OJB and DynaBeans
Posted by Antonio Gallardo <ag...@agsoftware.dnsalias.com>.
Hi Sylvain:
The idea is good at all. There can be 2 approach:
1) Use the database to just store the forms:
- Don't care about primary keys, normalization, relations and similars.
This way any database can act as a simple form repository. Forms can be
"isolated islands" inside the database
-You need to do all the validations at the application level. It remembers
me the times where some people used FoxPro as a set of tables without any
relations between them.
- This can be builded using what we currently have (as many pointed before
this post).
For me the best approach will be:
2) At the design time: A businness oriented CASE based on the defined
forms generates for you:
- the required database tables with relations, etc.
- the woody forms and binding
- the flows to manage the application.
This is my personal dream here. I know there are outthere some tools that
already do that but AFAIK does not work with Cocoon. :-(
We tought we can extend druid : <advertise> http://druid.sf.net
</advertise> to allow people define the forms in that way we can allow
people concentrate just in the form definition and the system will do the
rest for us.
As you noted before, non computer related people usually explain you what
they need in forms. The rest of the work is ours. So if we will have a
CASE that will allow us to define the form and do the rest, it will be
fine, right? ;-D
But this must be done at compile time. Not at run time.
Best Regards,
Antonio Gallardo
Re: [RT] Direct Form->SQL mapping through OJB and DynaBeans
Posted by Torsten Curdt <tc...@vafer.org>.
>> (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 ;-)
...lately I did some BCEL stuff, too ..that would make it two of us ;)
> 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!
KISS :-x
--
Torsten
Re: [RT] Direct Form->SQL mapping through OJB and DynaBeans
Posted by Sylvain Wallez <sy...@apache.org>.
Marc Portier wrote:
> 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
Re: [RT] Direct Form->SQL mapping through OJB and DynaBeans
Posted by Marc Portier <mp...@outerthought.org>.
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...
> 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?
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...
> 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?
(maybe in stead of dynabeans you could abuse the opportunity to boost
your bcel skills again ;-))
> Sylvain
>
> [1]
> http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils/DynaBean.html
>
>
--
Marc Portier http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at http://radio.weblogs.com/0116284/
mpo@outerthought.org mpo@apache.org
Re: [RT] Direct Form->SQL mapping through OJB and DynaBeans
Posted by Timothy Larson <ti...@yahoo.com>.
--- Sylvain Wallez <sy...@apache.org> wrote:
> Some people to which I demonstrated Woody and Flowscript asked me how we
> can directly map forms to a database.
...
> 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?
informal +1
--Tim Larson
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/
Re: [RT] Direct Form->SQL mapping through OJB and DynaBeans
Posted by Jeremy Quinn <je...@media.demon.co.uk>.
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
RE: [RT] Direct Form->SQL mapping through OJB and DynaBeans
Posted by JD Daniels <jd...@datatrio.com>.
Oh oh oh
I like this idea....
JD
-----Original Message-----
From: news [mailto:news@sea.gmane.org]On Behalf Of Sylvain Wallez
Sent: Friday, October 31, 2003 6:25 AM
To: dev@cocoon.apache.org
Subject: [RT] Direct Form->SQL mapping through OJB and DynaBeans
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.
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.
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!
What do you think?
Sylvain
[1]
http://jakarta.apache.org/commons/beanutils/api/org/apache/commons/beanutils
/DynaBean.html
--
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