I've seen this behaviour before if the primary key is not implemented
correctly e.g. if hashCode or equals hasn't been overridden for a String
based key. Is this the case?

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Aaron Mulder
Sent: Thursday, September 21, 2000 4:55 PM
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
 - findByPrimaryKey(foo) called to retrieve entity foo again
 - 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