You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Bruno CROS <br...@gmail.com> on 2006/02/02 17:54:51 UTC

1-n Auto-retrieve troubles

 Hello,

I now have spent a lot of time debugging 2 batch processing.
First processing creates a simple 1-n couple of object (consider that class
UnityCar refers a class Unity with 1-n relation) . Creation is done like
this :

- tx.begin()
- Unity u = new Unity()
- tx.lock(u, Transaction.WRITE);
- UnityCar uc = new UnityCar();
- uc.setUnity(u);
- tx.lock(uc, Transaction.WRITE);
- tx.commit();

Note that we have wrotten a lot a code working perfectly like this one.
Chance !

My problem occurs when a second processing read a Unity class. With the
auto-retrieve of the collection ( we need cache speed),  OJB should send me
a collection of 1 UnityCar, but it do this only a good while after first
processing !! Immediately after first processing, I have
NullPointerException getting the collection unityCars. I known that my
object is bad-loaded (no collection on unity.getUnityCars() ) and if a wait
( a probably cache expiration ) , that same objet is right loaded, with the
good collection !!

I tried a lot of solutions :
- mark first created object dirty with markDirty. No way.
- reload object (with getByIdentity)  after materialization. No way.
- checkpoint and reload. No way.
- restart. Yes of corse it works. But i definitely can't !!

-hum, does i have severals objects, many as Transactions !!? after commit ,
no ??

Working with OJB Version 1.0.1. I known it's old, but it works not so bad
for all we all have done at this day.

Does someone can explain that ? Help !!
Migration to 1.0.3 ? to 1.0.4 ?! Which one ? what is supposed to be
rewrotten ?

Thanks a lot to help me.


Sorry for my poor bad english.

Re: 1-n Auto-retrieve troubles

Posted by Armin Waibel <ar...@apache.org>.
Hi Bruno,

in OJB 1.0.2 we fixed a bug with partially materialized objects under 
heavy load. Assume that this bug cause your problem.
http://db.apache.org/ojb/release-notes.txt

I would recommend the migration to OJB 1.0.4.
But take care of changes between 1.0.1 and 1.0.4 (e.g. complete 
refactoring of odmg implementation done in 1.0.2/3, changed auto-xxx 
settings for odmg, ...) it's listed in the release-notes and in the docs 
(Caching, Inheritance, ...).
Strongly recommended:
http://db.apache.org/ojb/docu/guides/odmg-guide.html

regards,
Armin


Bruno CROS wrote:
>  Hello,
> 
> I now have spent a lot of time debugging 2 batch processing.
> First processing creates a simple 1-n couple of object (consider that class
> UnityCar refers a class Unity with 1-n relation) . Creation is done like
> this :
> 
> - tx.begin()
> - Unity u = new Unity()
> - tx.lock(u, Transaction.WRITE);
> - UnityCar uc = new UnityCar();
> - uc.setUnity(u);
> - tx.lock(uc, Transaction.WRITE);
> - tx.commit();
> 
> Note that we have wrotten a lot a code working perfectly like this one.
> Chance !
> 
> My problem occurs when a second processing read a Unity class. With the
> auto-retrieve of the collection ( we need cache speed),  OJB should send me
> a collection of 1 UnityCar, but it do this only a good while after first
> processing !! Immediately after first processing, I have
> NullPointerException getting the collection unityCars. I known that my
> object is bad-loaded (no collection on unity.getUnityCars() ) and if a wait
> ( a probably cache expiration ) , that same objet is right loaded, with the
> good collection !!
> 
> I tried a lot of solutions :
> - mark first created object dirty with markDirty. No way.
> - reload object (with getByIdentity)  after materialization. No way.
> - checkpoint and reload. No way.
> - restart. Yes of corse it works. But i definitely can't !!
> 
> -hum, does i have severals objects, many as Transactions !!? after commit ,
> no ??
> 
> Working with OJB Version 1.0.1. I known it's old, but it works not so bad
> for all we all have done at this day.
> 
> Does someone can explain that ? Help !!
> Migration to 1.0.3 ? to 1.0.4 ?! Which one ? what is supposed to be
> rewrotten ?
> 
> Thanks a lot to help me.
> 
> 
> Sorry for my poor bad english.
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org