Solved

How EJB Works

Posted on 2004-08-22
8
1,405 Views
Last Modified: 2012-05-05
Hi, I have been reading all the "concepts" and theory in the net regarding this EJB stuffs.

The most informative so far i think is this :

http://www.javaworld.com/javaworld/jw-12-2001/jw-1207-yesnoejb.html

But I have something no so clear about this EJB advantages.

Most of the people mentioned, EJB can help to achieve this stuffs, Scalability, Security and Transactions. But i wonder technically how this works....

If we talk about Scalability, how EJB can help in this sense?

If we mentioned security, isn't that the normal JavaBean-JSP stuff can perform authentication and authorization? How great is this EJB can help to mantain a better security senario?? Which part of the bean (entity or session or CMP or BMP) is working for this purpose?

Pretneding the transaction issues, hm... this is the real things about EJB, frommy point of view. In terms of technically how this works... i am not so sure.. any ideas..

On the reading from the URL above, i also notice this few words, on the "The Rule Book".
The author mentioned,
.... where you must preserve the ACID (Atomicity, consistency, isloation and durability)....

Anyone have any ideas what is this ACID mean for? Can EJB do this stuffs?

I am just confused...

Currently my company is looing forward to migrate all the application into EJB. I am leading the migration. I erally really need your professional advice on this.

Please suggest any Technical readup to me. I will be grateful if you can share with me you rules of thumbs when you learn this EJB stuffs..

THANK YOU sooo much.

0
Comment
Question by:fks
  • 4
  • 3
8 Comments
 
LVL 35

Assisted Solution

by:TimYates
TimYates earned 200 total points
Comment Utility
> If we talk about Scalability, how EJB can help in this sense?

You can cluster EJB containers (such as JBoss), so you can add a new machine, and split the request handling between them

> How great is this EJB can help to mantain a better security senario?

It isn't necessarially better, but it is another layer of security

> In terms of technically how this works... i am not so sure.. any ideas..

You can set the transaction level of each function in the ejb layer, so that functions can be one of the following 6 levels (in EJB 2):

REQUIRED        Methods executed within a transaction.  If client provides transaction, it is used; if not, new transaction generated.  Commit at end of method.  Well-suited for EJB Sessions.
MANDATORY       Client of this EJB must create a transaction in which this method operates, otherwise an error. Well-suited for EJB Entitys.
REQUIRES_NEW       Methods executed within a transaction.  If client provides transaction, it is suspended.  A new transaction is generated, regardless.  Commit at end of method.
SUPPORTS       Transactions optional.
NOT_SUPPORTED       Transactions not supported; if provided, ignored..
BEAN_MANAGED       Code in the EJB responsible for explicit transaction control.

> Anyone have any ideas what is this ACID mean for?

http://www.unix.org.ua/orelly/java-ent/ebeans/ch08_01.htm#INDEX-1558

> Please suggest any Technical readup to me.

http://www.amazon.com/exec/obidos/tg/detail/-/0596002262/qid=1093245931/sr=8-1/ref=pd_ka_1/104-5638035-6198338?v=glance&s=books&n=507846

is a good book, and

http://www.jboss.org

is a good, free EJB container...

Hope I helped a bit :-)

Tim
0
 
LVL 11

Accepted Solution

by:
sompol_kiatkamolchai earned 300 total points
Comment Utility
Hello fks,

I will answer your question one by one.

>>If we talk about Scalability, how EJB can help in this sense?
we can set a pool of EJB instances and when we start up EJB container, it will create a pool of EJB instances that ready to serve client request. The client will have a good response from server. When the request from client increase, EJB will decide to create more instance to be ready to server in a pool.

>>How great is this EJB can help to mantain a better security senario??
In EJB we can define security role to restrict access to each method in each EJB. It is defined in deployment descriptor(ejb-jar.xml) that mean it does not need for programming.

>>Which part of the bean (entity or session or CMP or BMP) is working for this purpose?
It just a declaration in deployment descriptor. in each type of EJB you can set this security per method and interface.

>>Pretneding the transaction issues, hm... this is the real things about EJB, frommy point of view. In terms of technically
Yes. it likes security. both security and transaction are infrastructure server that provide by J2EE container and it can be easily configured in deployment descriptor. The benefit that J2EE delcare this in deployment descirptor is we can change it without re-compile source code.

>>how this works... i am not so sure.. any ideas..
For transaction it used JTA(Java Transaction API)

>>what is this ACID mean for?
Atomicity, --> you can set transaction. for classical example, when you want to transfer money, you need to withdraw from one account and deposit to another one. If we can withdraw but we cannot deposit(It will cause by many reason such as connection to db have problem or target account does not exist...) so the money will lost from system. So you can do 2 operation as atomic. if 2 operation can do, the transaction will commit. If one of them have error, all will be discard.

consistency, --> it means that when concurrent access to EJB, how container manage consistency of data. one client may try to update and another one try to read. you can configure this behavior in deployment descriptor.

isloation --> Isolation is level of locking database. EJB allows us to set the level of isolation. the more level we set, the more integrity of data we have. but If we set it to the highest, the speed of access will slow down.
1.read uncommitted
2.read committed
3.repeatable read
4.serializable

and durability --> for stateful session bean or entity bean it can survive when the container crash becuase it can persist state to persistent storage such as database.

More info, please feel free to ask me..

Regards,

SoMpoL
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
Comment Utility
The standard infrastructure that container provide.
-distributed transaction management
-security management
-concurrent access to ejb
-persistent management in entity bean or stateful session bean
-resource pooling
-resource caching
-load balancing
-fail over.

Cheers,
0
 

Author Comment

by:fks
Comment Utility
SoMpoL, can share your experience how you pick up this EJB stuffs?

Any particular web site , books you have ho through?

0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:fks
Comment Utility
TimYates, thanks for the URL, really thanks for the sample EJBbooks you have suggested.

TQ.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
Comment Utility
I think the best reference for me is J2EE spec from Sun Microsystem. It may author not the best but it is the original source that I can check whether my understanding is true or not.

http://java.sun.com/products/ejb/docs.html

For other document you can find it at

http://www.theserverside.com

There are many good stuff here.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
Comment Utility
0
 

Author Comment

by:fks
Comment Utility
thank you for your respond..

i think other than asking around here, i have to do dome R&D myself and get familiar with it.

sompol, Tim, thanks for the time.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now