Get your Enterprise JavaBeans Developer Certificate

You are thinking about getting Oracle Enterprise JavaBeans Developer certified? Good preparation, willingness to learn, curiosity and meeting the prior certification requirements are the best preconditions in order to pass the exam.

Questions

The questions have different levels of toughness and have a multiple choice format. Easy questions may look like this:

A session bean (Account) has to throw exceptions in two different cases What type of exceptions should be used for these two cases ?

(1) A debit operation is performed and there are not sufficient funds in the account.

(2) The bean is not able to get a database connection.

Tougher questions may have this content:

What can a client infer if it receives an exception while calling a method of an EJB 3.x bean?

The two exemplary questions are answered at the end of this post.

Preparation

You can achieve good preparation with different books about EJB. Most of them cover more subjects than necessary for the certification. Those insights are quite useful to gain a broader perspective and therefore a better understanding of Java EE. Furthermore I recommend the software enthuware [http://enthuware.com/]. It provides serval sample questions and mock exams. I personally think it is the best learning software right now for this certificate. Theory alone might get you through the certification but if you really want to feel like an EJB expert try implementing your own little EJB project or apply your knowledge in a working project in your daily job.

Covering all subjects in this blogpost is impossible. This blogpost is just an approach to aggregate some important aspects for the certification.

stateful session bean stateless session bean singleton bean message driven bean
Can provide a web service client view X X
Can define Timer X X X
Can declare asynchronous services X X
Can use interceptors X X X
Table 1- Differences

 

Class
level
Field
level
Method
level
@javax.ejb.Init X
@javax.ejb.EJB X X X
@javax.ejb.TransactionAttribute X X
@javax.annotation.Resource X X X
@javax.annotation.security.RolesAllowed X X
@javax.ejb.TransactionManagement X
@javax.annotation.security.DeclareRoles X
@javax.annotation.security.RunAs X
Table 2- Annotations and their possible locations

 

NotSupported Executes without any transaction context (The caller’s transaction  context, will be suspended)
Required If the caller has a transaction context, the method will execute in that transaction context otherwise a new transaction context is created
Supports If the caller has a transaction context, it will be used otherwise the method will execute without any transaction context
RequiresNew A new transaction context is always created
Mandatory The caller must have a transaction context otherwise an Exception is thrown
Never The caller must NOT have a transaction context otherwise an Exception is thrown
Table 3- Different transaction attributes and their characteristics

 

How to package a mybean.XBean.class in a war file?
/(Root)
|-- WEB-INF
   |-- classes
      |-- mybean
         |-- XBean.class

place classes either in WEB-INF/classes or packaged in a 
jar file in in WEB-INF/lib
How does a Jar file look that packages all classes in module test.ejbprocessing?
/(Root)
 |-- META-INF
    |-- MANIFEST.MF
    |-- ejb-jar.xml
 |
 |-- test
    |-- ejbprocessing
       |-- <all classes here>
How does an ear look like (contains ejbprocessing.jar  and serval classes XBean etc. )?
|-- META-INF
   |-- application.xml
   |-- ejbprocessing.jar

look of the ejbprocessing.jar:
 |-- META-INF
    |-- ejb-jar.xml
    |-- orm.xml (optional)
    |-- persistence.xml
 |-- XBean.class, X.class, XServiceLocal.class
Table 4- Different structures of a .jar  .ear or  .war file

 

Questions – Answers

A session bean (Account) has to throw exceptions in two different cases What type of exceptions should be used for these cases?

(1) application exception

(2) system exception

What can a client infer if it receives an exception while calling a method of an EJB 3.x bean?

If the client receives an application exception, it can assume that the bean still exists and can continue to call the enterprise bean. An application exception does not result in the container discarding the bean. Furthermore if an application exception does not usually call the transaction to rollback either, unless it is annotated as @ApplicationException(rollback=true) or the transaction is explicitly rolled back (for example by calling setRollbackOnly() ) If the client receives a EJBTransactionRolledbackException, the transaction certainly has been rolled back or marked for rollback.  In contrast EJBException does not tell anything about the status of the transaction.

 

 

References

Andrew Lee Rubinger, Bill Burke (2011): Enterprise JavaBeans 3.1, O’Reilly Media

Eric Jendrock, Ricardo Cervera-Navarro, Ian Evans, Devika Gollapudi, Kim Haase, William Markito, Chinmayee Srivathsa (2013): The Java EE 6 Tutorial in: http://docs.oracle.com/javaee/6/tutorial/doc/

Enthuware Mock Exams – http://enthuware.com/index.php/mock-exams/oracle-certified-expert/oceejbd-ejb-6

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s