Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How EJB Works

Posted on 2004-08-22
8
Medium Priority
?
1,429 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 35

Assisted Solution

by:TimYates
TimYates earned 800 total points
ID: 11867822
> 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 1200 total points
ID: 11867852
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
ID: 11867863
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

Any particular web site , books you have ho through?

0
 

Author Comment

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

TQ.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 11877344
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
 

Author Comment

by:fks
ID: 11888327
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Want to know how to use Exchange Server Eseutil command? Go through this article as it gives you the know-how.
What we learned in Webroot's webinar on multi-vector protection.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

721 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