Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1449
  • Last Modified:

How EJB Works

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
fks
Asked:
fks
  • 4
  • 3
2 Solutions
 
TimYatesCommented:
> 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
 
sompol_kiatkamolchaiCommented:
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
 
sompol_kiatkamolchaiCommented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
fksAuthor Commented:
SoMpoL, can share your experience how you pick up this EJB stuffs?

Any particular web site , books you have ho through?

0
 
fksAuthor Commented:
TimYates, thanks for the URL, really thanks for the sample EJBbooks you have suggested.

TQ.
0
 
sompol_kiatkamolchaiCommented:
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
 
sompol_kiatkamolchaiCommented:
0
 
fksAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now