Bugs item #521035, was opened at 2002-02-21 08:13
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=521035&group_id=22866

Category: JBossCMP
Group: v2.4 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Stepan Roh (src)
Assigned to: Nobody/Anonymous (nobody)
Summary: findByXXX() after passivation

Initial Comment:
Let's have this model situation:

DataEntityBean
LinkEntityBean which has one field named data pointing
to DataEntityBean

Data field is in fact
org.jboss.ejb.plugins.jrmp.interfaces.EntityHandleImpl
and is serialized as MarshalledObject into database as
array of bytes or its equivalent - and here lies the
problem, because I have two handles with different
binary representations and different hashcodes, but
pointing to the same bean:
handle1.getEJBObject().isIdentical
(handle2.getEJBObject()). So if I call
LinkEntityHome.findByData (handle1) and handle2 is
stored in the database, I will receive empty
collection, because compare is done byte-per-byte.

And now how I received these two different handles
(client code):

data = DataEntityBean.create();
link = LinkEntityBean.create(data);
... now wait 'till beans passivate ...
link.findByData(data); - this will return empty collection

(Be warned that the bug does not occur with this simple
example, but only with our bigger products and I was
not able to make an example which will reproduce it. My
simple bean model is just a problem illustration.)

data is in fact handle1 and from log I can clearly see
that handle1 was stored into database when link was
created, but after link bean was passivated and later
actived, it somehow gets replaced with handle2 (UPDATE
is clearly seen in logs). So handle1 is in client and
handle2 is stored in database. And, voila, bug is here.

We implemented a workaround: we are not storing beans
in our clients, but rather store its PKs and find the
beans with them. This is, BTW, the way most servlets
work when using EJB, so the bug won't occur there.

I have a ~4 MB log with very detailed debugging
messages which I can send to someone (need some
filtering for sensitive information) and also those
serialized handles.

I can't see the reason why I can't hold the beans on
client for a long time. I hope I did not overlooked
something and this is a real bug.

We have clearly found this bug in JBoss versions 2.4.0,
2.4.3 and 2.4.4.


----------------------------------------------------------------------

>Comment By: Stepan Roh (src)
Date: 2002-02-22 01:44

Message:
Logged In: YES 
user_id=465763

[answer to vlangelo]

vlangelo:"There's no requirement in the spec that two
handles to the same bean be byte for byte equivalent.
Handles are not intended to be used for long term
persistence. There is also no guarantee that a handle from v
2.x will continue to work with all future versions of a server."

So it is clearly a bug in JBoss CMP if it compares those
handles byte-per-byte (by delegating this comparison to
database). I'm just following the EJB 1.1 specs.


----------------------------------------------------------------------

Comment By: Victor Langelo (vlangelo)
Date: 2002-02-21 10:27

Message:
Logged In: YES 
user_id=169968

There's no requirement in the spec that two handles to the
same bean be byte for byte equivalent. Handles are not
intended to be used for long term persistence. There is also
no guarantee that a handle from v 2.x will continue to work
with all future versions of a server.

You should be using the entity bean's id. If link data might
be more than one bean type, you'll need to keep the id plus
an identifier for the bean home.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=521035&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to