cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <>
Subject Re: Woody: managing persistence sessions
Date Tue, 04 Nov 2003 12:56:54 GMT
Jeremy Quinn dijo:
> On Tuesday, November 4, 2003, at 11:10 AM, Antonio Gallardo wrote:
> Thanks for your feedback, Antonio.
>> Hi Jeremy:
>> I use other approach in Flow. Example:
>> function listform(form) {
>>   var factory = cocoon.getComponent(Packages.o.a.c....JdoPMF.ROLE);
>> var bean = new Packages.test.forms.AreasList();
>>   var handler = new Packages.test.forms.AreaHandler();
>>   var criteria = new String (cocoon.request.criteria);
>>   handler.getList(bean, criteria, factory);  // Read from DB
> OK, I think I understand your approach ..... AreaHandler.getList and
> AreaHandler.setList open and close the session as required. (?), so
> that the Session is actually closed before Form.showForm is called.

>From your flow code in your first mail. I understand that "session" is a
Hibernate session (line 2) that you get from the factory (line 1):

var factory = cocoon.getComponent (PersistenceFactory.ROLE);
var session = factory.createSession ();

If this is correct this is similar to getting a PersistenManager in OJB.

> Does OJB have a concept similar to Hibernate's 'lazy-initialisation'?

Yep. You can choose if you wish all the resultSet at once or get them as
you  request it.

Also you can define is the Bean will fill all the collections (references
by Foreign Keys - or better called "details" in a "master-detail"
relation). I thought this is "lazy-initialisations", right?

I short OJB support all Hibernate support. I can said this because the
project leader of OJB told that in a recent mail:

> I have not even approached this issue yet, because currently our User
> is not related to any other Tables, but it will be in the future .....

Yes. I am currently at this example (see attached PNG file):

A form that create Roles for users. We have a subform for auth_permisions)
and in each row of subform a a selection list to choose (auth_resources).
Is this the idea?

As we make a step in the application... (BTW, currently very slow because
too many new things - OJB, JDO, Woody, Flow, JXPath .... but it is cool!)
we tought how we can improve the overall. I think it is a nice experience.

BTW, if you ask how I did the diagram. All I will said is: Druid (damn
here is again!).

Currently druid (CVS version) build all the JavaBeans (including Javadocs
for them) and the O/R mapping for OJB. I am sure Drui can do this because
I generated with them the currently database (71 tables with 383 fields).
I thought this will be very boring writing it by hand. Fortunately, druid
did this for me. :-D

All you need to do is:

Choose a target output dir
click some options
generate Java and OJB
and the worse is in the command line you type: ant.
and voila! you have a jar with all your beans + Javadocs of them.

Note: The beans are also JDO enhanced.

It looks very simple, right? ;-)

> Does your AreaHandler clone the persistent properties into your Bean,
> or does it merely make object references?

Currently I am coping them because JDO will clean all the Beans I got from
the Query. And here is when Apache Jarkarta commons-beanutils comes in the
action! We can simply copy beans using:


> AFAIU if you are using
> lazy-initialisation, you would need to clone the values, to make sure
> the SQL calls were made while your session was still open..


Best Regards,

Antonio Gallardo

View raw message