Solved

How EJB Works

Posted on 2004-08-22
8
1,408 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
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 300 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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
 
LVL 11

Expert Comment

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

930 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

12 Experts available now in Live!

Get 1:1 Help Now