Hi Armin: 
  Finally I got your test program worked with the following changes:
 (i) In OJB.properties
   changed the ObjectCacheCLass to 
ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl

  (ii) set the DB Id to zero. 
broker.beginTransaction();
        Person p = new Person();
        p.setFirstname("no_1_"+timestamp);
        p.setLastname("no_1_"+timestamp);
        broker.store(p);
        p.setId(0);  <<<<========set the db id to 0
        p.setFirstname("no_2_"+timestamp);
        p.setLastname("no_2_"+timestamp);
        broker.store(p);
broker.commitTransaction();


Was that a BUG in OJB 0.9.8 ? 

thanks again for your help. 
~ajitesh


-----Original Message-----
From: Ajitesh Das [mailto:[EMAIL PROTECTED]
Sent: Friday, July 04, 2003 7:11 PM
To: OJB Users List; Armin Waibel
Subject: RE: inserting "reused" objects in a loop


Hi Armin: 
  thanks for your reply. 
I am using kind a old version : 0.9.8 
Was this a bug in that old version ? 
Which one you are using in your test? 
I just tried your test code. Your test code does not work on 0.9.8 
If I do: 
   p = new Person(); 
after the first store it works. 
~ajitesh


-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Friday, July 04, 2003 2:06 PM
To: OJB Users List
Subject: Re: inserting "reused" objects in a loop


Hi,

which version of OJB do you use?

Do a similar test - all works fine (with clearing cache
or without clearing).

The test:

broker.beginTransaction();
        Person p = new Person();
        p.setFirstname("no_1_"+timestamp);
        p.setLastname("no_1_"+timestamp);
        broker.store(p);
        p.setFirstname("no_2_"+timestamp);
        p.setLastname("no_2_"+timestamp);
        broker.store(p);
broker.commitTransaction();

        Identity id = new Identity(p, broker);
        Person result = (Person) broker.getObjectByIdentity(id);
        assertNotNull(result);
        assertEquals("no_2_"+timestamp, result.getFirstname());
        assertEquals("no_2_"+timestamp, result.getLastname());

regards,
Armin

----- Original Message -----
From: "Ajitesh Das" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 04, 2003 9:33 PM
Subject: inserting "reused" objects in a loop


> When I am trying to "reuse" the object to "store" again, I am getting
the
> silent failure. If I create a new object before the failed store call,
the
> "store" method passes thro' fine. Does OJB marks the object as
"already
> used"?
> The following code reproduces the issue:
>     broker = PersistenceBrokerFactory.defaultPersistenceBroker();
>     broker.beginTransaction();
>     Test zs = new Test();
>     System.out.println("<<<1>>>Setting attributes of Test");
>     zs.setPosX(30);
>     zs.setPosY(40);
>     broker.store(zs);
>
>          // if I uncomment following statement, the 2nd "store"
>          // method works fine
>    // ts = new Test();
>
>     System.out.println("<<<2>>>Setting attributes of Test");
>     zs.setPosX(31);
>     zs.setPosY(41);
>           broker.store(zs); // 2nd broker.store method call
>     broker.commitTransaction();
> the second call "broker.store()" fails silently and does not store
> data directly.
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to