> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Aaron Mulder
> Sent: Thursday, September 21, 2000 8:55 AM
> To: jBoss Developer
> Subject: Re: [jBoss-Dev] Entity instance problems...
>
>
>       It's hard to diagnose this without more information.  Code would
> be most helpful, but lacking that, let me see if I have this straight:
>
>  - session call begins, transaction created
>  - entity is created (with PK foo, and other value 1)
>  - at this point, the DB should hold 1
>  - entity is updated (still PK foo, other value now 2)
>  - at this point, the DB should hold 2

well since it participates in the transaction initiated by the session, it
won't get stored to the DB  until the transaction commits at the end.  So it
is normal behaviour (and spec compliant) that the DB holds 1.

>  - findByPrimaryKey(foo) called to retrieve entity foo again

Here there is something spooky.  Even if the PK is screwed up it should find
the cache instance, hence show 2.  The find obviously misses cache and goes
to the DB.  Now I am rewriting the cache the tx behaviour and the locking
mechanism (yesterday and today, getting there, but it's a marathon).  The
cache structure is fairly simplified and fail safe (jonathan weedon idea
with part of simone implementation of cache key).  Let's give it a spin at
this point.

marc

>  - at this point, the DB should hold 2 still
>  - but the returned entity foo holds 1
>  - session call ends, transaction committed
>
>       Is that right?  If I have the database stuff straight, are you
> using CMP or BMP?  Are you using a normal JDBC 1/2 driver or a vendor
> native JDBC 2 Optional Package driver?  Or is there no DB at all (now that
> I look, I see you didn't mention one)?
>
> Aaron
>
> On Wed, 20 Sep 2000, Patrick J. McNerthney wrote:
> > JBoss,
> >
> >   Here is the latest problem I am running into in my attempt to port my
> > application from WebLogic to jBoss.
> >
> >   The following sequence of events is not working correctly:
> >
> > 1.  A stateless session bean method is called with a transaction
> > required.
> > 2.  While within #1, a "Sequence" entity bean which provides a
> > sequential counter is created.  The current counter value of 1 (since it
> > has just been created) is retrieved.  When this counter value is
> > retrieved, the entity bean increments it's value to 2 for the next time
> > it is called.
> > 3.  Also while within #1, another sub-routine does an entity find to
> > retrieve the same Sequence entity bean created in #2.  When the current
> > counter value is retrieved, 1 is returned.
> >
> >   This is incorrect, a counter value of 2 should be returned (which
> > WebLogic does return).  It appears that the entity find process during
> > step #3 does not end up using the same instance of the Sequence ejb
> > implementation that was created during step #2, but instead instantiates
> > a new instance with the image that was persisted during the entity
> > create.
> >
> >
> > Pat McNerthney
> > Icicle Software, Inc.
> >
>
>
>


Reply via email to