• Post Reply Bookmark Topic Watch Topic
  • New Topic

Some basic EJB help needed...  RSS feed

 
Andr� Korsnes Bruns�l
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all!

I know java, jsp and servlets, but I would like to use session and entity beans in my app. Where should I put the code that uses the bean?

(yes...code snippets are helpful )

thanks
Andr�
 
Alana Sparx
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andre

I'm also a bit of a beginner in this areas, but you'll want to invoke your session bean somewhere in your client application. From the brief description of the architecture you describe, probably you'll call the session interfaces from a servlet, although you may want to consider creating a facade to the EJB layer, and having your servlet call the facade (which in turn invokes the bean). (If you were using the struts framework, you'd call the bean/facade from the relevant Action class).

Take some time to consider wether your client application (the WAR) will run inside the same JVM as the EJB jar- if so, you may want to invoke the session bean using the 'local' & 'local home' interfaces as opposed to the 'remote' & 'remote home' interfaces. Can't give you any advice on entity beans as I rarely use them.

I found the jndi bindings for the local interfaces to be a pain in the arse - you can find my sorry tale over on the IBM/Websphere board, including some code snippets:

local bean invocation

Hope this helps
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!