cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Gallardo" <agalla...@agssa.net>
Subject Re: building Collection from JDO problems
Date Sat, 21 Feb 2004 14:05:52 GMT
Bert Van Kets dijo:
> Here is my flowscript. In this form it fails on dao.retrieve(linksBean,
> factory); because dao is undefined.
>
> cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody2.js");

Hint: Set the above line in sitemap to avoid writing it over and over:

<map:flow language="javascript">
  <map:script
src="resource://org/apache/cocoon/woody/flow/javascript/woody2.js"/>
 <!-- Here put other scripts,
      you can include many script as you want.
      I prefer to put in 1 file related functions for one operation
  -->
</map:flow>

> function linksForm_JDO(form) {
>     // Get OJB factory
>     var factory =
> cocoon.getComponent(Packages.org.apache.cocoon.ojb.jdo.components.JdoPMF.ROL
> E);
>     // Create a empty Bean
>     var linksBean = new Packages.be.bvar.admin.links.LinksBean();
                                                       ^^^^^^^^^^^

Not showed, but I guess it exists. Anyway this is not the problem.

>     var dao = new Packages.be.bvar.admin.links.LinksDAO();
>     cocoon.log.error("dao =" + dao);

When dao will got a right Object, the above line will print something like:

dao=be.bvar.admin.links.LinksDAO@11492ed

but you got dao=undefined

So this means you are not getting the right object. Flow is not able to
got it. Can you tell where are you deploying be.bvar.admin.links.LinksDAO?

Please write the full dir structure you are using in WEB-INF/classes.

This is not really a JDO problem this is a Flow problem that cannot find
the right Java class.

> And here is the DAO class (I took the update method out to minimise teh
> possible problems) :

OK. :-D

> package be.bvar.admin.links;
> import java.util.Collection;
> import javax.jdo.PersistenceManager;
> import javax.jdo.Query;
> import org.apache.cocoon.ojb.jdo.components.JdoPMF;
> /**
> * @author BeKe
> *
> */
> public class linksDAO {
>     public void retrieve(LinksBean bean, JdoPMF pmf) {
>         /* 1. Get the PersistenceManager */
>         PersistenceManager persistenceManager =
> pmf.getPersistenceManager();
>         // 2. start transaction
>         persistenceManager.currentTransaction().begin();
>         Query query =
> persistenceManager.newQuery(be.bvar.admin.links.Link.class);
>         Collection thisCollection = (Collection) query.execute();
>         bean.setLinks(thisCollection);
>         // 3. End transaction
>         persistenceManager.currentTransaction().commit();
>     }
> }
>
> And here is the class descriptor from the repository.xml file :
> <class-descriptor class="be.bvar.admin.links.Links" table="links">
                                               ^^^^^

This class is diferent from the LinksBean. Why you are using 2 diferent
classes? Any way here is not the problem.

>     <field-descriptor name="ID" column="ID" jdbc-type="INTEGER"
> primarykey="true"/>
>     <field-descriptor name="url" column="url" jdbc-type="VARCHAR"/>
>     <field-descriptor name="titel" column="title" jdbc-type="VARCHAR"/>
>     <field-descriptor name="description" column="description"
> jdbc-type="VARCHAR"/>
>  </class-descriptor>

Best Regards,

Antonio Gallardo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message