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 Daniel Perry <d....@netcase.co.uk> on 2004/01/07 11:49:57 UTC
PB Tutorial (ERROR) and question
I was just reading the tutorial on the PB API, and came accross a slight error:
In the "Deleting Persistent Objects",
PersistenceBrokerFactory.defaultPersistenceBroker();
Should be:
broker = PersistenceBrokerFactory.defaultPersistenceBroker();
One more thing, using ODMG i have been doing tx.markDirty(object) to update an object outside of a transaction. If i do a broker.store(object) outside of a transaction will this have the same effect?
Thanks,
Daniel.
Re: PB Tutorial (ERROR) and question
Posted by Philippe Hacquin <ha...@wanadoo.fr>.
Hi Brian,
nice to hear that; this is the way I handle updates on my objects, and
it goes pretty well. To make things clear, tell me if I'm wrong,
re-query the object by identity is the only way to get a reference to
the object directly from the cache to avoid querying the database
(provided OJB is configured with a cache, of course).
This is something that was not obvious when I first studied the
tutorials (well, I began back in March last year, before you had a
chance to enhance them), and may be worth to mention, in my opinion.
Brian McCallister wrote:
[...]
>
> On the ODMG markDirty / store thing... I don't know for sure, but there
> is a potential for lost updates when using markDirty(...). The practice
> I have had recommended, and use, is to just re-query it by identity in
> the bounds of a transaction and make the changes, rather than modifying
> a persistent object outside of a transaction and forcing changes back in.
[...]
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: PB Tutorial (ERROR) and question
Posted by Daniel Perry <d....@netcase.co.uk>.
Thanks,
That makes sense. Though in my current application there is practically no
chance of objects being concurrently updated. And if it did happen, it
wouldn;t really matter.
However in future projects, i can see i will need to use transactions.
Thanks,
Daniel.
----- Original Message -----
From: "Brian McCallister" <mc...@forthillcompany.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Wednesday, January 07, 2004 2:28 PM
Subject: Re: PB Tutorial (ERROR) and question
> On the tutorial type -- thank you! I just fixed in OJB_1_0 and HEAD =)
>
> On the ODMG markDirty / store thing... I don't know for sure, but there
> is a potential for lost updates when using markDirty(...). The practice
> I have had recommended, and use, is to just re-query it by identity in
> the bounds of a transaction and make the changes, rather than modifying
> a persistent object outside of a transaction and forcing changes back
> in.
>
> -Brian
>
> On Jan 7, 2004, at 5:49 AM, Daniel Perry wrote:
>
> > I was just reading the tutorial on the PB API, and came accross a
> > slight error:
> > In the "Deleting Persistent Objects",
> > PersistenceBrokerFactory.defaultPersistenceBroker();
> > Should be:
> > broker = PersistenceBrokerFactory.defaultPersistenceBroker();
> >
> > One more thing, using ODMG i have been doing tx.markDirty(object) to
> > update an object outside of a transaction. If i do a
> > broker.store(object) outside of a transaction will this have the same
> > effect?
> >
> > Thanks,
> > Daniel.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: PB Tutorial (ERROR) and question
Posted by Brian McCallister <mc...@forthillcompany.com>.
On the tutorial type -- thank you! I just fixed in OJB_1_0 and HEAD =)
On the ODMG markDirty / store thing... I don't know for sure, but there
is a potential for lost updates when using markDirty(...). The practice
I have had recommended, and use, is to just re-query it by identity in
the bounds of a transaction and make the changes, rather than modifying
a persistent object outside of a transaction and forcing changes back
in.
-Brian
On Jan 7, 2004, at 5:49 AM, Daniel Perry wrote:
> I was just reading the tutorial on the PB API, and came accross a
> slight error:
> In the "Deleting Persistent Objects",
> PersistenceBrokerFactory.defaultPersistenceBroker();
> Should be:
> broker = PersistenceBrokerFactory.defaultPersistenceBroker();
>
> One more thing, using ODMG i have been doing tx.markDirty(object) to
> update an object outside of a transaction. If i do a
> broker.store(object) outside of a transaction will this have the same
> effect?
>
> Thanks,
> Daniel.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org