Forums Register Login

Calling EJB's or just regular classes

+Pie Number of slices to send: Send
I'm new to EJB's and J2EE and have a question that I can't quite deduce.
In a design I'm looking at, we have an engine that uses session beans to instantiate custom objects that conform to an interface. So for instance, the session beans in the engine will at runtime learn the class information for these custom objects and create them as needed (or do a JNDI lookup). These objects all implement a common interface so the engine knows how to talk to them.
These custom objects will live in the same appserver as the engine and there is no decision around whether or not we want to require these custom objects to be EJB's themselves.
What I'm having trouble with is trying to understand the advantages or disadvantages of having these custom objects as simply java classes or EJB's. If they are regular java objects, then the engine will create them and I'm assuming they will inherit all the advantages of living within the appserver along with the engine's session beans. If they are EJB's themselves and the session bean invokes them, am I only making the engine less efficient, or can these custom EJB objects do more than if I had implemented them as regular java classes? There will be no situation where the custom objects will need to live on another app server.
These custom objects have no use outside the engine, so no other client would ever access them other than the engine.
So what all this lengthy question deduces to: Why would I want to call an EJB (EJB A) from another EJB (EJB B) as opposed to just making EJB A a regular java class?
thanks,
Neil
+Pie Number of slices to send: Send
Please refer to "Core J2EE Patterns" book from Sun.
It has some patterns which will guide you to the right direction for your situation.
With respect to EJB or the object by itself, if you are creating the objects based on legacy data or through database info its better to go with Entity beans for transactional security etc.
But you can stick with the session beans accessing the objects in your engine to serve up for the client. It really depends on how these objects are instantiated as I explained above.
Hope it helps.
Kishore.
[ January 18, 2002: Message edited by: Kishore Dandu ]
How do they get the deer to cross at the signs? Or to read this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 820 times.
Similar Threads
EJB deployment problems
EJB that extends Properties cant create interface
Differences between EJB and regular Java Beans
to use an EJB or not?
What's the main difference between regular Java Beans and EJB ?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:50:50.