Showing posts with label EJB. Show all posts
Showing posts with label EJB. Show all posts

7 September 2012

EJB version history

Year
Java EE
EJB
What’s new
1998

1.0
Stateful Session Beans
Stateless Session Beans
Entity Beans
JNDI
Thread safe
JTA
1999
1.2
1.1
XML descriptors
RMI over IIOP
2001
1.3
2.0
local beans
2003
1.4
2.1
SOAP support
Message driven beans
2006
5
3.0
JPA replaces Entity beans
POJOs/annotations
2009
6
3.1
CDI
@Asynchronous
@Singleton
2013
7
3.2

28 January 2009

EJB3 default interceptors

To apply an interceptor class (auctionsystem.infra.EJBMonitor in this example) to all beans, add to the deployment descriptor (ejb-jar.xml):

<ejb-jar>
  <interceptors>
    <interceptor>
      <interceptor-class>auctionsystem.helper.EJBMonitor</interceptor-class>
    </interceptor>
  </interceptors>
  <assembly-descriptor>
    <interceptor-binding>
      <ejb-name>*</ejb-name>
      <interceptor-class>auctionsystem.helper.EJBMonitor</interceptor-class>
    </interceptor-binding>
  </assembly-descriptor>
</ejb-jar>

The order in which interceptors are called is:
  1. default interceptors
  2. class level interceptors (interceptors on superclasses are called first)
  3. method level interceptors
To overrule calling of interceptors with larger scope use these annotations:
  1. @ExcludeDefaultInterceptors
  2. @ExcludeClassInterceptors
There are similar defaults for JPA, but these don't work currently in glassfish (issue 2821)

21 December 2008

JMS producer code example

Alternate example for Code 8-1 in SL351-EE5.
This example features:
- ejb client container resource injection
- Queue/topic agnostic API (JMS 1.1)

EJB life cycle callback handlers

SL-351-EE5 Extra excercise 10.1

1 Create a JMS connection when the AuctionManagerBean is created.
   Make the connection an attribute of the bean
2 Close the JMS Connection when the bean is destroyed.



Solution

15 December 2008

EJB2 => EJB3

These slides show an example of the changes in a session bean going from EJB 2 to EJB 3

27 June 2008

SCBCD

Did the sun JEE5 certification yesterday.
I started preparing the evening before, which did not leave nearly enough time,
but all was well :)
The exam is not easy, which is a plus for it's credibility, compared to some mock certifications on the market.
The EJB3 course I'm teaching at sun (sl351) is a good start, but not sufficient.
Mikalai
Zaikin
's SCBCD 5.0 Study Guide was the best resource I found on the web.

Topics I got:

  • JNDI, JPQL, transactions, exceptions, rollback
  • combining transactions and entitymanager
  • orm mapping of an association class
  • NO deployment descriptor syntax questions
  • libraries included in JEE5
  • mapping users to roles
  • business method that you can call locally/remotely
  • at which level can you apply specific annotations?
  • legal return types for @webmethod
  • composite primary keys
  • mixing EJB2/3
  • persistence units