EJB referencing question

can I reference another entity EJB in ejbCreate() method?

for example:
This is what I want to do in my entityA EJB

public int TrackRecord::ejbCreate (int data)
{
   InitialContext ctx = new InitialContext();

   CounterLocalHome home = (CounterLocalHome)ctx.lookup ("ejb/CounterLocalHome");

   counter = home.getPrimaryKey(1);

   this.rowId = counter.increment();
   this.data = data;

   return rowId;
}
zollenAsked:
Who is Participating?
 
girionisConnect With a Mentor Commented:
I don't see why you couldn't.
0
 
Mayank SAssociate Director - Product EngineeringCommented:
What exactly do you want to do? What's the requirement that drives you to do that?
0
 
girionisCommented:
Just try it and see if it works.
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
Mayank SAssociate Director - Product EngineeringCommented:
It should work :) but what's the need to do that ;-) ?

I see a small design-flaw here. If this.rowId needs the value which it obtains from home.getPrimaryKey(1).increment.... can't that be done from outside the ejbCreate () method as well? The calling block of code can obtain that value and pass it from somewhere....
0
 
girionisCommented:
:)
0
 
zollenAuthor Commented:
well. u are the first one to answer my question :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.