I did not check yet for other fields. I will do it now and see. But it will take some
time until our next development iteration is finished and released.
As I said, I perform the check inside one of business methods of the entity bean:
public abstract class TerminalBean extends MMSBean implements EntityBean {
[...]
public TerminalDO getTerminalDO() {
//todo: remove when fixed
TerminalPK pkViaEc = (TerminalPK)entityContext.getEJBLocalObject().getPrimaryKey();
TerminalPK pkViaGetters = new TerminalPK(getVendor(), getModel());
if (!pkViaEc.equals(pkViaGetters)) {
logger.error("pkViaEc="+pkViaEc+", pkViaGetters="+pkViaGetters);
}
//entityContext.getEJBLocalObject().getPrimaryKey() is buggy and sometimes returns
primary key of
//another object
return new TerminalDO(new TerminalPK(getVendor(), getModel()),
getPropertyDOs(), getDescription(), getModel(), getVendor());
}
[...]
}
Another case for me is when customer is authenticated on the site, I save the ejb
handle of Customer bean in servlet session. After that to obtain a local interface of
the Customer Bean I use
Customer customer = (Customer)((CustomerRemote)handle.getEJBObject()).getLocalObject()
where getLocalObject() is implemented as a business method
public EJBLocalObject getLocalObject() {
return entityContext.getEJBLocalObject();
}
At this point I get the local interface of another customer (not the one the handle
points to).
After that I again use the customer.getPrimaryKey() of the customer in further
business logic...
I will install the check of other fields and let you know.
> -----Original Message-----
> From: Alexey Loubyansky [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 10, 2003 18:10
> To: Alexey Yudichev
> Subject: Re: [JBoss-user] entityContext.getEJBLocalObject()
> returns local interface of another object
>
>
> Hello Alexey,
>
> what about other fields? Do their values correspond to the context
> with the expected primary key or to the context that is actually
> present?
>
> When do you perform the check?
> More details would really be appreciated.
>
> Thank you,
> alex
>
> Thursday, July 10, 2003, 5:04:06 PM, Alexey Yudichev wrote:
>
> AY> I am using Jboss 3.2.1
> AY> Sometimes entityContext.getEJBLocalObject() returns local
> interface of another instance of the same entity bean.
>
> AY> I have a superclass for all my entities in application
> which implements EntityBean's setEntityContext() method and
> saves entityContext in a field.
> AY> Inside one of business methods of one of entity beans I
> check if a primary key constructed from key CMP field(s)
> matches a primary key obtained from
> AY> entityContext.getEJBLocalObject().getPrimaryKey().
> Sometimes they do not match:
> entityContext.getEJBLocalObject().getPrimaryKey() returns
> primary key of another instance of the same entity bean.
>
> AY> I have sometimes situations when user is logged in as one
> customer and enjoys privileges of another...
>
> AY> This happens ~20 times a day with a particular single
> object for me... I could install some kind of bug trap
> logging some debug info to help fix the bug.
>
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Parasoft
> Error proof Web apps, automate testing & more.
> Download & eval WebKing and get a free book.
> www.parasoft.com/bulletproofapps1
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
>
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user