You are right, OJB supports ODMG's "persistence by reachability": you just have to add new or already persisted objects to the DList of your root object, and its persistence will be handled transparently.

Anyway, you should theoretically place your read query in a transaction context to check your results:

        tx.begin();    // <--
       DList allProducts = (DList) query.execute();
        Iterator iter = allProducts.iterator();
        while (iter.hasNext())
        {
                customer=(Customer)iter.next();
                System.out.println(customer.getBenutzername() + ": " +
                customer.getCertificates().size());
        }
        tx.commit();    // <--

I always place all read or write accesses in a transaction context, and everything goes fine.

I guess results should be right if the write and the read accesses would be in the same transaction context, too.

HTH

Gunnar Hilling wrote:

On Fri, 10 Oct 2003 14:03:05 +1300, Shane Mingins wrote:




By using the auto-insert/update settings and the PersistenceBroker I get
what I expect.


So far this is also working with odmg in my test (in the given code
example I'm persisting the Certificate-Object implicit:

customer.addCertificate(certificate);

without persisting certificate using db.makePersistant



Anyway as I have mentioned my experience is not vast so I would defer to
expert advice/opinion :-)






---------------------------------------------------------------------
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]



Reply via email to