Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

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;
}
0
zollen
Asked:
zollen
  • 3
  • 2
1 Solution
 
girionisCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now