Stephan Michels dijo: > Am Mo, den 29.03.2004 schrieb Antonio Gallardo um 22:35: >> Stephan Michels dijo: >> > Ahh I forget to say that the examples depend on jdo.jar :-/ I wanted >> to >> > rewrite the example to use the OJB classes only, but didn't make it >> > until now. >> > >> > The exception is somehow confusing, see >> > "'org.apache.cocoon.ojb.jdo.components.JdoPMF' is referenced, but >> cannot >> > be loaded" >> >> Is there a posibility to check if the jdo.jar's are avaliable? We do >> this >> in the build.xml of Cocoon. This is why if you don't have the jdo.jar >> you >> are able to build cocoon. > > The OJB folks use following snippet in their build file: > <condition property="jdo.classes"> > <and> > <available classname="javax.jdo.PersistenceManager" > classpathref="compilation-classpath"/> > </and> > </condition> > > <target name="check-jdo-classes" unless="jdo.classes"> > <fail>jdo.jar is missing! Please get it from > http://java.sun.com/products/jdo. Put it in lib or have the ant property > jdo.jars point at this jar file.</fail> > </target> > > I rewrote the example now. I'm really not a OJB expert, nor a database > expert. > I made this example to learn more about OJB and JDO, and I didn't get the > "insert" method work properly.
I am not a gump expert :-D The following is to try to explain how it works, it is not an excuse in any form: The problem while inserting a row in the JDO sample is clear: How it would insert if the called code is in a missing jdo.jar? OJB has 3 APIS inside PB, ODMG and JDO. Currently, we can use any of them to interact with DB inside Cocoon. If I turn off one of 3 in the cocoon.xconf I cannot expect to be able to insert in a DB using the missing API. The OJB build system needs an explict special tag "with-jdori" to use the JDO stuff. The cocoon build system (CBS) allows succesful compile even if there is not a jdo.jar at all without any special switch. The CBS "detect" the presence of the jdo.jar. We also wrote mocks classes just in case there is not a jdo.jar at all. Best Regards, Antonio Gallardo
