• Post Reply Bookmark Topic Watch Topic
  • New Topic

ejbLoad() problem  RSS feed

jeff zhang
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a BME bean which is supposed to provide services to
outside calls. The bean needs to access two different database
servers for some of its method invocations. I tried to use
a flag value inside ejbLoad() to determine which server the persistence fields should come from. But, I did not get what I
expect due to wrong flag value. Can anybody help me?
The following is a pieces of codes:
public void ejbLoad()
BeanPK (BeanPK) context.getPrimaryKey();
Connection con = null;
if (flag = 1)
else if (flag = 2)
The flag is an instance variable and was set in methods like
findByPrimaryKey(), findFromdbA(), and findFromdbB(). If caller
invokes findFromdbA() and findFromdbB() alternatively, the wrong
flag value will be seen.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!