You were right, I failed to replace a .jar under the WEB-INF/lib dir.
thanks.
----- Original Message -----
From: "Armin Waibel" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, April 13, 2004 5:58 PM
Subject: Re: Problems saving a m:n relationship
> Stijn de Witt wrote:
>
> > Hi Armin, all,
> >
> > I have tried your solutions, but I ran into a problem, because I was
working
> > with rc4. ojb rc4 doesn't have the .link() method in the
ServiceBrokerHelper
> > yet.
> > So I downloaded rc6, ran the ojb-blank target, inserted my files and
created
> > a rc6-version of my project. I got it all to build, but at the first
> > ojb-related query, I get this in my logging window:
> >
> > 15:52:11,531 INFO [BaseSubmitter] handleSubmit: Getting persistence
> > broker...
> > 15:52:12,031 INFO [STDOUT] [BOOT] WARN:
> > 15:52:12,031 INFO [STDOUT] Value
> > "org.apache.ojb.odmg.collections.DListImpl_2" is illegal for key
> > "OqlCollectionClass" (should be a class, using default value
> > org.apache.ojb.odmg.collections.DListImpl)
> > 15:52:12,359 INFO [STDOUT] [DEFAULT] ERROR:
> > 15:52:12,359 INFO [STDOUT] **
> > org.apache.ojb.broker.metadata.RepositoryTags: Tag 'object-cache' is not
> > defined. **
> >
> > Does this mean anything to you?
> >
>
> this sounds like a classloader problem. Do really replace all ojb-jar
> files (and config files) in your app classpath?
>
> regards,
> Armin
>
>
> > Thanks,
> > -Stijn
> >
> >
> > ----- Original Message -----
> > From: "Armin Waibel" <[EMAIL PROTECTED]>
> > To: "OJB Users List" <[EMAIL PROTECTED]>
> > Sent: Friday, April 09, 2004 2:00 PM
> > Subject: Re: Problems saving a m:n relationship
> >
> >
> >
> >>Hi Stijn,
> >>
> >>a few days ago I wrote some tests for M:N handling in odmg-api and
> >>stumble across the same problem (hope we can fix this soon). There are
> >>two possible workarounds:
> >>
> >>Transaction tx = odmg.newTransaction();
> >>tx.begin();
> >>Iterator it = person.getAddresses().iterator();
> >>while(it.hasNext())
> >>{
> >> database.makePersistent(it.next());
> >>}
> >>database.makePersistent(person);
> >>tx.commit();
> >>
> >>or you can use the pb-api to insert your object (this looks a little bit
> >>complex, because you have to set auto-update/delete false when using
> >>odmg-api):
> >>
> >>TransactionExt tx = (TransactionExt) odmg.newTransaction();
> >>tx.begin();
> >>PersistenceBroker pb = tx.getBroker();
> >>Iterator it = person.getAddresses().iterator();
> >>while(it.hasNext())
> >>{
> >> pb.store(it.next());
> >>}
> >>pb.store(person);
> >>pb.serviceBrokerHelper().link(person, true);
> >>tx.commit();
> >>
> >>Hope this will help you.
> >>
> >>regards,
> >>Armin
> >>
> >>Stijn de Witt wrote:
> >>
> >>
> >>>Hi,
> >>>
> >>>I have a problem trying to persist two objects that are related through
> >
> > an indirection table. This is what my tables look like:
> >
> >>>-----
> >>>PERSON
> >>>id
> >>>firstname
> >>>lastname
> >>>...
> >>>
> >>>ADDRESS
> >>>id
> >>>street
> >>>housenr
> >>>...
> >>>
> >>>PERSON_ADDRESS
> >>>person_id
> >>>address_id
> >>>-----
> >>>
> >>>
> >>>I have chosen for this construction, because COMPANY can have multiple
> >
> > addresses too, so I don't want a column person_id in ADDRESS. One
address
> > doesn't have to be available for multiple PERSON's or COMPANY's or
whatever,
> > so it actually is more of a 1:n relationship using an indirection table.
So
> > PERSON_ADDRESS will often contain the same person_id multiple times, but
not
> > the same address_id.
> >
> >>>I've read the tutorials, but I don't get it to work. I'll show (a
> >
> > fragment of) our repository_user.xml:
> >
> >>>
> >>>-----
> >>><class-descriptor
> >>> class="nl.bergland.codamo.Address"
> >>> table="bit_Address"
> >>>
> >>> <field-descriptor
> >>> name="id"
> >>> column="id"
> >>> jdbc-type="INTEGER"
> >>> primarykey="true"
> >>> length="11"
> >>> >
> >>> </field-descriptor>
> >>> <field-descriptor
> >>> name="street"
> >>> column="street"
> >>> jdbc-type="VARCHAR"
> >>> length="64"
> >>> >
> >>> </field-descriptor>
> >>> <field-descriptor
> >>> name="houseNr"
> >>> column="houseNr"
> >>> jdbc-type="VARCHAR"
> >>> length="16"
> >>> >
> >>> </field-descriptor>
> >>></class-descriptor>
> >>>
> >>><class-descriptor
> >>> class="nl.bergland.codamo.Person"
> >>> table="bit_Person"
> >>>
> >>> <field-descriptor
> >>> name="id"
> >>> column="id"
> >>> jdbc-type="INTEGER"
> >>> primarykey="true"
> >>> length="11"
> >>> >
> >>> </field-descriptor>
> >>> <field-descriptor
> >>> name="firstName"
> >>> column="firstName"
> >>> jdbc-type="VARCHAR"
> >>> length="24"
> >>> >
> >>> </field-descriptor>
> >>> <field-descriptor
> >>> name="lastName"
> >>> column="lastName"
> >>> jdbc-type="VARCHAR"
> >>> length="24"
> >>> >
> >>> </field-descriptor>
> >>> <collection-descriptor
> >>> name="addresses"
> >>> element-class-ref="nl.bergland.codamo.Address"
> >>> indirection-table="bit_PersonAddress"
> >>> auto-retrieve="true"
> >>> auto-update="true"
> >>> auto-delete="true"
> >>> >
> >>> <fk-pointing-to-this-class column="personId"/>
> >>> <fk-pointing-to-element-class column="addressId"/>
> >>> </collection-descriptor>
> >>></class-descriptor>
> >>>-----
> >>>
> >>>
> >>>The generated tables in mysql seem to be ok with me (we actually use
> >
> > OjbDoclet to generate the repository.xml and the SQL) and insertion of a
> > PERSON works fine. However, when we create a new person, add a new
Address
> > to it and try to save the person, the following happens:
> >
> >>>A new record gets created for PERSON fine
> >>>A new record gets created for ADDRESS fine, but when I set auto-update
> >
> > to true, 2 get created??
> >
> >>>A new record gets created for PERSON_ADDRESS, but both the columns
> >
> > person_id and address_id are set to 0.
> >
> >>>Our save code looks something like this:
> >>>
> >>>
> >>>-----
> >>> Person person = new Person;
> >>> person.getAddresses().add(new Address());
> >>>
> >>> Implementation impl = OJB.getInstance();
> >>> Database db = impl.newDatabase();
> >>>
> >>> db.open("default", Database.OPEN_READ_WRITE);
> >>> Transaction tx = impl.newTransaction();
> >>> tx.begin();
> >>>
> >>> // establish database locks on all root dataobjects
> >>> tx.lock(person, Transaction.WRITE);
> >>>
> >>>
> >>> // set person and address values
> >>> // ...
> >>>
> >>> tx.commit();
> >>> db.close();
> >>>-----
> >>>
> >>>
> >>>A lot of info for a first-time post, I hope this problem sounds
familiar
> >
> > to someone here.
> >
> >>>Thanks,
> >>>
> >>>-Stijn
> >>>
> >>>
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]