Defining EJB 3.1 Views (Local, Remote, No-Interface)

This post will talk about possible ways of defining EJB views using annotations (I’ll just mention about using EJB Deployment Descriptor at the end.) I’ll focus on the most current EJB 3.1 views omitting legacy local, remote and home interfaces. Therefore, we can choose between: remote business interface view, local business interface view, no-interface view. I won’t discuss functional differences between those views but rather focus on possible ways of defining them. ...

March 20, 2013 · 5 min

Can I Use WAR With Java EE 6 Full Profile?

Java EE 6 brings a lot new features. Among the others there is the concept of profiles. Java EE starts with the definition of two: Full and Web Profile. The idea is to create separate and more specialized set of services that better suits your job. E.g. if you only want to use Servlets, JSP and add some EJB’s – do you really need full-blown application server with JMS, JMX, CORBA, JAX-WS and a lot of other abbreviations? ...

November 11, 2012 · 2 min

EJB 3.1 Interceptors -- Same Transaction, Same Principal

Few days ago I’ve created a simple interceptors spike-solution at Github. Its purpose was to show my colleagues that in the EJB’s interceptors you can implement a code that exists in the same transaction and the same security context as the called EJB business method. Moreover, you can benefit from all the dependency injection you need. This project uses the following resources injected by the Application Server: TransactionSynchronizationRegistry – used for getting current transaction key and checking if we’re in the same transaction (I’ve written about it e.g. here), SessionContext – for reading user’s principal – user’s security context is also available in the interceptor, EntityManager – to persist some data before invoking the business method; it exists in the same transaction as the called method, so either both: the interceptor persistence and business method ends with success or both of them will be rolled-back. This example also shows how easily you can add RESTful Web Service to your application (take a look at com.piotrnowicki.interceptors.web package). ...

November 11, 2012 · 2 min