The following is a brief list of the new features of EJB3.1
1. no interface required
2. singleton EJB: @Singleton
3. timer based services: @Schedule
4. Asynchronous EJB: @Asynchronous
5. As showed in the previous blogs, EJBs can now be packaged in a web archive .war
Next, i'll do simple experiments on these new features to make sure i really understand how they work, and possibly, how they can be used.
1. no interface required
@Stateless
public class MyEjb { ...}
2. singleton EJB: @Singleton
@Singleton
public class MySingleton { ... }
3. timer based services: @Schedule
@Stateless
public class MyTimerBean {
@Schedule(dayOfWeek="Sun", hour="0")
public void soSomething() { ... }
}
4. Asynchronous EJB: @Asynchronous
@Stateless
public class MyAsynchBean {
@Asynchronous
public void doSomething(User u) {
try {
changeSomething(u);
sendNotification(u);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
5. As showed in the previous blogs, EJBs can now be packaged in a web archive .war
Next, i'll do simple experiments on these new features to make sure i really understand how they work, and possibly, how they can be used.