On 08.02.2006 15:08, Alessandro Vincelli wrote:

The problem occur when i try to insert new row

I receive this error on:
form.save(Elenco);


java.lang.NoSuchMethodException: org.apache.ojb.broker.util.collections.RemovalAwareCollection.add(w4b.com.cassagest.db.Docuassist)
in my binding definition I have this:
        <fb:on-insert-row>
<fb:insert-bean classname="w4b.com.cassagest.db.Docuassist" addmethod="add"/>
        </fb:on-insert-row>

How Can I add object to a Collection from  OJB?

The insert is done by reflection. If you search for a method "add" with Docuassist.class as parameter while Collection has a method "add" with Object.class you will get the above exception as the parameters are not upcasted. This is why you probably can not add beans directly to collections, but I haven't tried it recently. I wrote an application based on OJB and CForms 1,5 years ago and did the binding with a delegating method:

binding:
<fb:on-insert-row>
  <fb:insert-bean classname="com.ewerk.erak.model.InterestRate"
                  addmethod="addInterestRate"/>
</fb:on-insert-row>

object:
public void addInterestRate(InterestRate interestRate) {
    getInterestRates().add(interestRate);
}

where getInterestRates() returns the collection, i.e. OJB's RemovalAwareCollection instance.

Jörg

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