You are on page 1of 9

 

 
Unit   –  II   ­  EJB   ARCHITECTURE 
 
PART   –A 
 
1. What   is   Transaction   Processors?  
Transaction  is  a  group  of  SQL  statements.  In  Transaction  Processor 
several  statements  to  be  executed  together  as  one  logical  unit,  thereby 
guaranteeing  that  either  all  statements  would  be  executed  successfully  or  none. 
The  Transaction  Processor  was  designed  to  solve  several  business  needs.  A 
typical   transaction   program   that   consists   of   at   least   three   calls:  
● Begin 
● Commit  
● Rollback 
 
2. What   are   the   ACID   properties   of   Transactions? 
 
● Atomicity  
This  property  states  that  all  actions  that  are  part  of  a  transaction 
will  execute  as  one  logical  unit;  either  all  will  complete 
successfully   or   the   transaction   will   be   undone.  
● Consistency 
This   property   states   that   the   underlying   database   will   always   be   in 
a   reasonable   state.    It   guarantees   that,   if   a  transaction   fails   in 
mid­operation,   the   database   will   not   be   left   in   a  partially   modified 
state;   any   changes   to   the   database   must   be   undone. 
● Isolation  
This   property   states   that,   until   a  transaction   has   been   committed,   its 
state   is   not   visible   from   outside   itself. 
● Durability  
This   property   states   that,   once   the   transaction   has   been   completed   , 
the   changes   are   stored   permanently. 
 
     3.   Write   abbreviation   of   OLTP   and   list   out   their   characteristics. 
OLTP   ­>   On­Line   Transaction   Processing. 
 
  OLTP   system   Characteristics   are: 
● An   OLTP   system   updates   data   in   a  database.  
● Response   time   is   critical   for   OLTP   systems. 
● An   OLTP   system   typically   handles   a  large   volume   of   transactions. 
4.   Write   abbreviation   of   OLAP,   DSS,   EIS   systems   and   list   out   their   characteristics. 
OLAP   ­>   On­Line   Analytical   Processing  
DSS      ­>     Decision   Support   Systems 

 
 

 
 
EIS       ­>     Enterprise   Information   System  
These   Systems   characteristics   are: 
● It   is   used   to   review   information;   generally   it   does   not   involve 
database   updates. 
● Response   time   is   not   as   critical   as   for   an   OLTP   system;   it   may 
involve   long­running   queries. 
● This   type   of   system   typically   generates   a  smaller   number   of 
requests;   because   it   provides   data   for   review,   user   “think   time” 
tends   to   be   longer.  
 
5.   Write   about   Two­Tier   Client­Server   Architecture 
The   combination   of   the   database   server   and   the   PC   client   is   commonly 
referred   to   as“two­tier”   architecture   or   client­server   architecture.   In   this   system, 
transaction   integrity   is   usually   guaranteed   by   the   database   management   system   itself, 
rather   than   by   an   external   transaction   process.   The   application   of   this   system   runs   on   the 
client   machine   and   issue   queries   to   the   database   server.   The   Client   contains   both 
● Presentation   logic 
● Business   Logic 
 
6.   Write   about   Three­Tier   Client­Server   Architecture 
In   the   three­tier   approach,   the   database   is   the   ultimate   repository   of 
information   and   the   client   remains   responsible   for   providing   the   user­interface   logic.   The 
business   rules   are   separated   into   a  middle   tier.   The   database   server   appears   separately. 
The   Client   contains   presentation   logic   for   user   interaction   and   the   middleware   contains 
business   logic   to   access   the   database   server.    The   Three­Tier   architecture   can   be 
implemented   using   a  wide   variety   of   approaches,   including   the   following: 
● Sockets 
● RPCs 
● CORBA 
● RMI 
● OLE/DCOM 
● Message   Queue 
 
7.   Write   about   CORBA. 
CORBA   stand   for   Common   Object   Request   Broker   Architecture.   CORBA   
  Can  be  envisioned  as  an  object­oriented  RPC  mechanism.  CORBA  also  uses  an  IDL  to 
specify  the  argument  types  and  return  types  of  functions, but the CORBA IDL  includes 
semantics  for  describing  objects  ,  unlike  the  stub  IDL.  A  CORBA  developer  writes  an 
IDL  through  the  compiler.  The  CORBA  architecture  also  includes  an  Object  Request 
Broker  (ORB).  The  ORB  is  the  component  that  allows  clients  to  communication  with 
server   objects   and   services. 
● One  very  important  facet  of  CORBA  is  that  it  allows  objects  written  in 
one  language  on one platform to be called by objects written in a different 
language   on   a  different   platform. 

 
 

 
 
● A   typical   CORBA   server   object   is   multithreaded. 
 
8.   What   is   RMI? 
RMI  stands  for  Remote  Method  Invocation.  This  is  basically  a  Java­only 
version  of  CORBA.  Because  RMI  is  specific  to  java,  it’s  a  bit  simpler  to  use  than 
CORBA.  The  RMI  compiler  is  rmic  which  generates  stub  and  skeleton  classes  directly 
from   .class   files.   RMI     understands   Java   types,   client   request.  
 
 
9.   What   is   OLE/DCOM? 
Microsoft  offers  one  approach  to  distributed  computing  based  on  the  company’s 
Object  Linking  and  Embedding  (OLE)  architecture.  This  approach  has  been  dubbed  the 
Distributed  internetworking  Architecture  (DNA),  and  several  other names. Microsoft has 
voiced   a  strong   commitment   to   the   OLE/DCOM   object   model. 
 
10.   List   out   EJB’s   Role. 
● EJB   specifies   an   execution   environment. 
● EJB   exists   in   the   middle   tier. 
● EJB   supports   transaction   processing  
● EJB   can   maintain   state. 
● EJB   is   simple  
 
11.   What   are   all   the   services   provided   by   the   EJB   container?  
● Support   for   Transactions 
● Support   for   persistence  
● Support   for   security  
● Management   of   multiple   instances   of   a  given   bean 
● Proxy   objects   for   each   bean. 
● Keeps   track   of   state   information  
● Platform   independence  
● Multi­tier   Architecture 
● Concurrent   execution   of   many   beans  
 
12.   List   out   the   key   features   of   the   EJB   architecture.  
● The   EJB   bean   exists   within   the   container. 
● The  client  never  communicates  directly  with  the  EJB  bean;  rather, it talks 
to  the  bean  through  its  home  interface  and  its  remote  interface,  both  of 
which   are   provided   by   the   container. 
● The  EJB  server  does  not  take  part  in  the  logical  conversation  between 
client  and  EJB  bean.  The  server  is  performing  a  lot  of  work  behind  the 
scenes­remember,  the  server  must  handle  requests  for  the  container  and 
feed  the  container  incoming  client  requests.  All  access  is  performed 
against   the   container. 
 

 
 

 
 
13.   What   is   declarative   transaction   management? 
Declarative  transaction  management  is  another  approach  in  EJB  container  for 
handling  Transaction  process.  In  this  approach  the  author  of  the  bean  can  specify  what 
type  of  transaction  support  the  bean  requires.  When  the  bean  is  deployed,  the  container 
reads  the  deployment  descriptor  associated  with  that  particular  EJB  bean  and 
automatically   provides   the   necessary   transaction   support. 
 
 
14.   What   are   the   six   possible   mode   of   transaction   in   EJB? 
● TX_NOT_SUPPORTED 
● TX_BEAN_MANAGED 
● TX_REQUIRED 
● TX_SUPPORTS 
● TX_REQUIRED_NEW 
● TX_MADATORY 
 
15.   How   the   EJB   server   managing   the   multiple   instances? 
The   server   may   perform   several   tasks   to   managing   the   multiple   instances: 
● Instance   Passivation 
● Instance   pooling  
● Database   connection   pooling 
● Precached   instances 
● Optimized   method   invocations 
 
16.   What   is   Instance   Passivation   ? 
  Instance  passivation  is  the  temporary  swapping  of  an  EJB  bean out to storage. If 
a  container  needs  resources,  it  may choose to temporarily swap out a bean. Both Session 
and  Entity  beans  can  be  passivated  .  For  Session  beans,  passivation  is  strictly performed 
as  a  convenience  for  the  EJB  container,  to  allow  it  t  free  up space.  For Entity beans, the 
mechanism  used  to  passivated  the  bean  is  also  used  to  synchronize  its  state  with  the 
underlying   data   store. 
 
17.   What   is   Instance   pooling? 
Instance  pooling  means  that  the  container  shares  instances  of  EJB  beans  among 
multiple  clients.  This  task  is  typically undertaken for purposes of efficiency; it allows the 
EJB  container  t  instantiate  fewer  copies  of  a  given  bean  to  service  requests.  Instance 
pooling  is  not  possible  in  all  cases;  because  a  stateful Session bean tracks conversational 
state   in   its   instance   variables,   the   container   must   provide   one   session   bean   per   client.  
 
18.   What   is   database   connection   pooling? 
Database  connection  pooling  is  a  strategy  commonly  employed  in  middleware 
applications.  In  this  approach,  when  a  component  to  access  a  database, it does not create 
a  new  database  connection;  instead,  it simply grabs a connection from a pool of available 
connections.   Database   connection   pooling   is   beneficial   for   two   reasons: 

 
 

 
 
○ It   avoid   overhead 
○ Maintain   an   open   database. 
 
19.   What   is   Precached   instances?  
Precached  instances  land  some  state  information  from  a  database  when  it  is 
created.  To  speed  up  the  loading  process,  it  is  possible  to  keep  a  cache  of  EJB  state 
information   in   some   readily   accessible   place   to   accelerate   the   initial   creation   of   EJB. 
 
20.   What   is   an   Optimized   method   invocation? 
Optimized   method   invocations   are   employed   to   combat   overhead   costs   associated  
With  remote invocation. Whether the client of an EJB is a remote client or another EJB in 
the  same  container,  the APIs used to gain access to it are always the same.  A typical EJB 
interaction   is   as   follows: 
● Use   a  naming   service   to   locate   the   EJB’s   home   interface. 
● Make  a  call  on  the  EJB’s  home  interface  to  gain  access  to  its  remote 
interface. 
● Make   calls   to   the   business   methods   against   the   remote   interface. 
 
21.   What   are   the   types   of   Enterprise   Beans? 
The   Enterprise   bean   classified   into   following   types.   These   are  
● Entity   Bean 
● Session   Bean  
 
22.   What   is   Session   beans   and   list   out   types   of   it? 
  Session  beans  are  for  managing  process  or  tasks.  A  Session  bean  is  mainly  for 
coordinating  particular  kinds  of  activities.  Session  beans  are  tied  to  the  lifetime  of  a 
given  client  session.  They  are  relatively  short­lived;  stateful  session  objects  are 
created  in  response  to  a  single  client’s  request,  communication  exclusively  with  a 
single  client,  and  die  when  the  client  no  longer  needs  them.  Thus  a  session  bean 
would  typically  be  used  to  provide  a  service  to  a  particular  client.  A  Session  bean  is 
required   to   implement   the   javax.ejb.SessionBean   interface. 
  The   Session   bean   classified   into   two   types.   These   are 
● Stateful   Session    Bean 
● Stateless   Session   Bean 
 
23.   What   is   Stateless   Session   Beans? 
Stateless  session  beans  do  not  maintain  any  conversational  state.  Each 
method  is  completely  independent  and  uses  only  data  passed  in  its  parameters.  One  can 
specify  whether  a  bean  is  stateful  or not in the bean’s deployment descriptor. A container 
can  easily  handle  a  state­  less  Session  bean  ,  because  instances of a stateless bean can be 
created   and   destroyed   at   will,   without   about   their   state   at   the   time   of   their   destruction. 
 
24.   What   is   Stateful   Session   Beans? 
Stateful  session  beans maintain conversational state when used by a client. 

 
 

 
 
A  Stateful  Session  bean  is  a  bean  that  changes  state  during  a  conversation. 
Conversational  state  is  not  written  to  a  database  but  can  store  some  state  in  private 
variables  during  one  method  call  and  a  subsequent  method  call  can  rely  on  this  state. 
Maintaining  a  conversational  state  allows  a  client  to carry on a conversation with a bean. 
As  each  method on the bean is invoked, the state of the session bean may change and that 
change   can   affect   subsequent   method   calls.  
 
25.   What   is   Entity   Beans? 
Entity  Beans  are  long­lived;  they  exist  across  client  sessions,  are  sheared  by 
multiple  clients,  and  remain  alive  even  after  a  restart  of  the  server  or  other  failure.  An 
Entity  EJB  object  represents  a  set  of  data  in  persistent  storage.  An  Entity  bean  must 
implement   the   Entity   Bean   interface. 
The   Entity   Beans   are   classified   as   follows: 
● Bean   Managed   and   Container    Managed   Persistence 
● Reentrant   and   No   reentrant   Entity   Beans  
 
26.   What   is   Bean   managed   Persistence? 
A Bean managed Persistence is one type of Entity bean. In this type , the author of 
the  bean  must  write  any  necessary  database  calls  to  send  the  object  out  to  persistent 
storage  and  read  it  back  in  again.  To  implement  bean­managed  persistence,  we  would 
place  our  database  calls  in  the  ejbLoad()  and  ejbStore()  routines.  The  container  calls 
ejbLoad()  to  notify  the  object  that  it  should  land  its  state  in  from  a  database.  The 
ejbStore()   notifies   the   object   that   it   should   write   its   state   out   to   the   database. 
 
27.   What   is   Container   Managed   Persistence?  
  Container  –managed  beans  have  their  persistence  automatically  managed  by  the 
EJB  container.  This  is  a  more  sophisticated  approach  and  here  the  bean  developer  does 
not  implement  the  persistence  logic.  The  developer  relies  on  the  development  descriptor 
to   specify   attributes   whose   persistence   should   be   managed   by   the   container   . 
 
28.   What   is   Non­Reentrant   Entity   Beans? 
Non­Reentrant  Entity  Beans  means  ,  if  a  call  is  being  processed  and another call 
to  the  same  object  comes  in  with  the  same  transaction context,  the program will throw a 
RemoteException   and   the   call   will   not   be   allowed.  
 
29.   What   is   Reentrant   Entity   Beans? 
Reentrant  Entity  Beans  accept  more  that  one  call  in  the same transaction context. 
That  is  ,  if a call is being processed  and another call to the same object comes in with the 
same  transaction  context,  the  program  will  allowed  it.  It  is  possible  to  specify  in  a 
deployment   descriptor   . 
 
30.   What   are   the   tasks   perform   by   the   client   in   EJB   conversation? 
● Finding   the   bean  
● Getting   access   to   a  bean 

 
 

 
 
● Calling   the   bean’s   methods 
● Getting   rid   of   the   bean 
 
31.   What   is   the   information   stored   in   deployment   descriptor? 
● The   name   of   the   EJB   class 
● The   name   of   the   EJB   home   interface  
● The   name   of   the   EJB   remote   interface  
● ACLs   of   entities    authorized   to   use   each   class   or   method 
● For   Entity   beans,   a  list   of   container­managed   fields 
● For  Session  beans,  a  value  denoting  whether  the  bean  is  stateful  or 
stateless 
 
1. Discuss   about   Remote   Interface. 
  This  interface  for  an  enterprise  bean  defines  the  enterprise  bean’s  business 
methods  that  clients  for  this  bean  can  access.  The  remote  interface  extends 
javax.ejb.EJBObject   ,  which   in   turn   extends   java.rmi.Remote.  
 
2. Discuss   about   Home   interface   . 
  This  interface  defines  the  bean’s  life  cycle  methods  such  as  creation of new 
beans,  removal  of  beans,  and  locating  beans.  The  Home  Interface  extends 
javax.ejb.EJBHome   ,  which   in   turn    extends   java.rmi.Remote. 
 
3. Write   about   Bean   Class. 
  The  Bean  Class  has  to  implement  the  bean’s  business  methods  in the remote 
interface  apart  from  some  other  callback  methods.  An  entity  bean  must  implement 
javax.ejb.EntityBean and a session bean must implement javax.ajb.SessionBean. Both 
EntityBean   and   Session   Bean   extend   javax.ejb.EnterpriseBean. 
 
4. What   is   primary   Key? 
This  is  very  simple  class  that  provides  a  reference  into  the  database.  This 
class   has   to   implement   java.io.Serializable.   Only   entity   beans   need   a  primary   key. 
A  primary key is an object of some user­defined type that can be used to look up a 
reference  to  a  particular  Entity  EJB.  The  getPrimaryKey()  method  returns  the 
primary   key   for   this   object. 
 
5. Write   about   Deployment   Descriptors. 
  Deployment Descriptor is a file that contains information about how beans 
are  managed  at  runtime.  There  are  some  common  primary  services  related  with 
distributed  systems  apart  from  some  specific  services  such  as  security,  transactions, 
naming  that  are  being  handled  automatically  by  EJB  server.  But  still  EJB  server  to 
know  beforehand  how  to  apply  the  primary  services  to  each  bean  class  at  runtime. 
Deployment   descriptors   exactly   do   this   all   important   task. 
 
6. What   is   a  JAR   file?   What   is   the   purpose   of   it? 

 
 

 
 
  JAR  files  are ZIP files that are used specifically for packaging Java Class 
that  are  ready  to  be  used in some type application. A JAR file containing one or more 
enterprise  beans  includes  the  beans  classes,  remote  interfaces,  home  interfaces,  and 
primary   key   for   each   bean.   It   also   contains   one   deployment   descriptor. 
  
 
PART   –B 
 
1.   Briefly   explain   EJB’s   Role   in   distributed   client/server   system. 
(Page   No.   :  13   –  16) 
  
2.   Discuss   following   concepts   in   detail.  
i. Transaction   Processors     (page   No.:   1  –  3) 
ii.   OLTP   versus   OLAP   (page   No.:   3­4) 
iii. Two­Tier   Client­server   Architecture   (page   No.:   4­7) 
iv. Three­Tier   Architecture   (page   No.:   7  –  12   ) 
 
3.   (i)   Draw   the   logical   Architecture   of   EJB   and   explain   it.   (Page   No.:   17) 
      (ii)Distributed   Transaction   Processing   (page   No.:   12   –  13)   
  (iii)  How  the  EJB  container  supports  for  Management  of  Multiple  Instances  (Page 
No.:   23   –  24) 
 
4.   Discuss   briefly   about     EJB’s   Software   Architecture   with   diagram.  
(Page   No.:   18   ­  41) 
 
5.    Explain   briefly   about   EJB   Container   and   their   services.    (Page   No.:   21   –  25) 
 
6.   Write   the   types   of   Enterprise   Bean   and   explain   it.   (Page   No.:   26­   41) 
 
7.   How   to   achieve   Conversation   in   EJB   and   explain   it.   (Page   No.:    41   –  45)  
 
8.    (i)   What   is   Client   ?  What   are   the   Clients   used   in   our   EJB   and   explain   it.  
(Page   No.:   43   –44)   
(ii)   How   to   build   and   deploy   EJB’s   (Page   No.:   45­46) 
 
9.   How   to   classify   Roles   in   EJB   to   construct   EJB   Application.    (Page   No.:   46   ­  48)   
 
10.   Discuss   detail   about   providers   in   EJB.    (Page   No.:   46   ­  48)   
 
11.    (i).   Write   about   EJBHome   Interface.   (Page   no.   :  27) 
        (ii).   Write   about   EJBObject   Interface.   (Page   no.   :  28) 
        (iii)   .  Discuss   about   EnterpriseBean   Interface.   (Page   no.   :  29) 
        (iv).   Discuss   about   EJBContext   Interface   .  (Page   no.   :  31) 
 

 
 

 
 
  12.   (i)   .  Explain   about   UserTransaction   Interface.   (Page   no.   :  33) 
       (ii).    Explain   about   SessionContext   Interface.   (Page   no.   :  34) 
       (iii).   Write    about   Session   Synchronization   Interface.   (Page   no.   :  36) 
       (iv).     Discuss   about   EntityBean   Interface.   (Page   no.   :  38) 
 
Book   Name      :   Enterprise   JavaBeans  
Author   Name:   Tom   Valesky  
 

 
 

 
 

You might also like