Solved

EJB referencing question

Posted on 2004-08-23
6
179 Views
Last Modified: 2013-11-24
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
Comment
Question by:zollen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 50 total points
ID: 11878617
I don't see why you couldn't.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 11878631
What exactly do you want to do? What's the requirement that drives you to do that?
0
 
LVL 35

Expert Comment

by:girionis
ID: 11878641
Just try it and see if it works.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 30

Expert Comment

by:Mayank S
ID: 11878669
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
 
LVL 35

Expert Comment

by:girionis
ID: 11882923
:)
0
 

Author Comment

by:zollen
ID: 11886219
well. u are the first one to answer my question :)
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question