Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB

 
Hari Prasad M
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to call an entity bean in the session with session facade design pattern ?

where we can write the database code ( which method)in session bean without entity bean ?


hari.mprasad@gmail.com
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hari,
There is a "EJB and Other J2EE Technologies" forum here:
http://www.coderanch.com/forums/f-11/EJB-JEE
 
ak pillai
author
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would take it that you are using ejb 2.0 or earlier. you should perform a JNDI lookup of your entity bean from your session fascade layer. if your session beans and entity beans are within the same EJB container then you can use your entity beans as local otherwise remote. session fascade pattern minimises your network trips.


If you do no want to use entity beans then use other O-R mapping tools like Hibernate, iBatis, TopLink etc. You should write your database logic in a DAO layer( look at DAO pattern).

Session beans layer calls --> business manager layer calls --> DAO layer (can use Hibernate etc or pure JDBC) calls --> Database
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic