36: What is bean managed transaction?
A: If a developer doesn't want a Container to manage transactions, it's
possible to implement all database operations manually...........
37: What are transaction attributes?
A: The transaction attribute specifies how the Container must manage
transactions for a method when a client invokes the method via the enterprise
bean’s home or...........
38: What are transaction isolation levels in EJB?
A: Transaction_read_uncommitted , Transaction_read_committed ,
Transaction_repeatable_read.
39: How EJB Invocation happens?
A: Step 1: Retrieve Home Object reference from Naming Service via JNDI.
step 2: Return Home Object reference to the client.
step 3: Create me a new EJB Object through Home Object interface.
step 4: Create EJB Object from the Ejb Object
step 5: Return EJB Object reference to the client.
step 6: Invoke business method using EJB Object reference.
step 7: Delegate request to Bean (Enterprise Bean).
40: Is it possible to share an HttpSession between a JSP and EJB? What happens
when I change a value in the HttpSession from inside an EJB?
A: You can pass the HttpSession as parameter to an EJB method, only if all
objects in session are serializable.This has to be consider as ?passed-by-value",
that means that it?s read-only in the EJB. If anything is altered from inside the
EJB, it won?t be reflected back to the HttpSession of the Servlet Container.The
?pass-by-reference? can be used between EJBs Remote Interfaces, as they are remote
references. While it IS possible to pass an HttpSession as a parameter to an EJB
object, it is considered to be ?bad practice ? in terms of object oriented design.
This is because you are creating an unnecessary coupling between back-end objects
(ejbs) and front-end objects (HttpSession). Create a higher-level of abstraction
for your ejb?s api. Rather than passing the whole, fat, HttpSession (which carries
with it a bunch of http semantics), create a class that acts as a value object (or
structure) that holds all the data you need to pass back and forth between
front-end/back-end. Consider the case where your ejb needs to support a
non-http-based client. This higher level of abstraction will be flexible enough to
support it.
Thursday, May 8, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment