I searched the archives, but could not find any other messages which are
experiencing the same problems that I am getting at the moment.

We have a small project attempting to use Entity beans using CMP.

Our home interface defines a few different finder methods.

findByPrimaryKey and findByPersonPK(PersonPK)

Here are the symptoms:

Call findByPersonPK - this returns a collection of Entity Beans.  We iterate
over these and dump the contents to our debug log.

Call findByPrimaryKey to get a single Entity (that was also returned in our
previous find), this returns a single Entity bean.
We call a mutator function (change one of the persisted fields).

Call findByPrimaryKey again and store in a different object (just 'cause I'm
paranoid), and dump the output to the debug log.  The beans internals have
changed as we expected.

Check the database (which is using the default Hypersonic, out of the box
one), and the field has changed.

Call findByPersonPK - gets new collection into a different object than the
first one (more paranoia), and dump the contents to our debug log.  The
original value (before the change) is shown.  This is the same as the one
showed in our last collection.  The database is then updated again (through
the call of ejbStore) and it overwrites our change back to what it was
before.

When we run the program again, the first collection is now an accurate
representation of the database (even though it is not what we wanted nor
expected), but when we do the first findByPrimaryKey and dump that out, it
shows the changed value not the database value.

What I think is happening here is a conflict somewhere in the bean cache.
The first finder that returns a collection creates one instance of our
particular entity bean.  The next finder creates another instance of that
entity bean.  We change the second one which then changes the database, and
everything appears fine, then we call the first finder again, which returns
its cached objects (which have the old value) and iterating through that
collection causes the database to be changed.  However when we run our test
application again all the cached entity beans are there but the two
instances of the one row contain different data.

Has anyone else come across this?  If so what did you do?  If not, is there
anyone on the JBoss team that can confirm this behaviour?  What do I need to
do to get it to work the way that I expect?

Thanks
Tim Penhey


------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated 
recipient(s) named above.  If you are not the intended recipient of this message you 
are hereby notified that any review, dissemination, distribution or copying of this 
message is strictly prohibited.  This communication is for information purposes only 
and should not be regarded as an offer to sell or as a solicitation of an offer to buy 
any financial product, an official confirmation of any transaction, or as an official 
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or 
error-free.  Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information is subject to 
change without notice.



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to