You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Joose Vettenranta <jo...@iki.fi> on 2004/07/25 13:40:49 UTC

cforms + bean

Hi,

reading from bean to forms works ok.
deleting (from repeater) works so that it is just removed from the list
updating is still a mystery for me.

I have bean using ojb to interact with the database.

Problems:

when I just remove data from the repeater (and removed from collection) 
ojb thingie does not know that it is removed, so I have to call delete 
for each child itself. So is it possible to make some method for cforms 
that is called when removing from bean? like if deleted, it would move 
deleted bean to another queue or set some field on that child to 
"removed". Then on update -process that removed queue could be read and 
removed those from db.

Updating I have no glue yet why it's not working. It seems like cforms 
can't map repeater-row to bean's child and therefor make new childs 
which causes the database to be inserted to database. Or does update 
work like this:

1. remove old child
2. insert new child

If like that, then I have to make removing work before update could 
work and would explain why it doesn't get updated, only inserted.

This btw, works:

         iterator=bean.getChilds().iterator();

         while (iterator.hasNext()) {
                 child = iterator.next();
                 child.setName ('Child XXX');
         }
         dao.update (bean, factory);

(changes every name of the child to 'Child XXX' and then does UPDATE to 
database on database)

Any tips?

files & stuff can be found from: http://joose.iki.fi/ojb/

Thanks,

Joose

--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


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