Hello Bert,

it seems we went exactly the same route this week. Maybe we should put together our efforts to get this thing working and to help other people with a wiki page. I only don't have that time til beginning of March because there is still an exam to be passed. So let me write a "short" mail about my experiences.

We have at least our own application running with OJB. We can retrieve lists or single objects from the db and display them with Woody, we can store them back and delete them. We only have still a problem with object identity, so that storing does indeed create a new object in db, but that's another problem we didn't have a closer look yesterday evening.

The way to this was long and stony, so you are not the only one :)

We started also with OJB/JDO and had bad feelings when we saw that we have to maintain at least two files (package.jdo, repository.xml) to get it working. The reason for it is that JDO and OJB are two different products, OJB provides only a plugin for Sun JDO at the moment, but both must get their configuration. Though it's easy to write a stylesheet that converts one format into the other I tried to use only JDO. But JDO is just the API, the SPI must be provided by the database vendor and as there are probably not that much for a specific at the moment, you need OJB. Then we found out that the JDO implementation has a performance problem: Retrieving 20 rows out of 6.000 in a db leads to instantiation of all 6.000 objects, they are filtered by JDO. That's not a problem of OJB, it's just how Sun JDO works. So we were back nearly to the beginning. We decided to go on with OJB (as it allows easy switch between different persistence frameworks (JDO, ODMG, OTM, PB)), but used the OTM. This one provides also object level transaction.

Now the application itself. I don't love the idea of accessing the persistence layer from the flow/controller layer directly. We access it only from the application layer to have obvious tiers. We have a DAOFactory that returns DAOs (e.g. either JDO or OTM), the implementation of the persistence framework access is abstracted. In theory we can switch to Castor, Hibernate or what else without touching the application layer. Each object specific DAO will provide different methods for retrieving, storing, deleting etc. As the layers below the flow layer are no Avalon components and not in relation to Cocoon, but "Plain Old Java" we kicked out Cocoon OJB block completely and just use OJB. If this was a good decision we will see. But it won't be that difficult to switch the datasource back to Avalon/Cocoon in OJB properties file.

BTW, we package all classes, configuration files and so on into our application JAR, deploy it in WEB-INF/lib and it works without any problem.

Joerg


On 18.02.2004 12:15, Bert Van Kets wrote:
I have been trying for several days to get grips on the "super trio" Woody,
Flow and OJB/JDO. I don't have any succes yet, but that is mainly to the
complexity of getting OJB/JDO to run. Could someone please shed a light on
this to get me going again?

I have created a bean to store all form data. The Woody form and the
FlowScipt have been created too. I have used the obj/woody sample as a
template to get things running. That's the easy part (relatively speaking).
I'm using mySQL as a databasource and have a datasource configured in
cocoon.xconf. This datasource is used in XSP pages using ESQL without any
problem, so that works for sure.
My biggest confusion is where I need to configure the link from the bean
datastore to the database. Where do I configure OJB and JDO?
I have OJB.properties, package.jdo, repository.dtd and repository.xml in the
WEB-INF/classes directory. I see a total overlap in the configuration in the
package.jdo and repository.xml file. Why is that? Is either of them not
needed?

I have created a DAO class file too. This is a direct copy of the
Employee_DAO class file from the samples. I only replaced the package and
replaced the bean methods with the ones from my bean. All this compiles
without any problem. The bean and the DAO class are packaged in a jar file
and put in the WEB-INF lib directory. I assume this is where I will
eventually create queries using OJB code to fill the bean with data. Am I
correct?

Thanks a lot for any help,
Bert

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



Reply via email to