Entities as Local Interface Parameters Can Harm You

Let’s start with a short quiz. TxMergeBean is a SLSB that uses CMT and EntityManager. Assume the following local and remote business interfaces: public interface TxMergeCommon { void methodA(); void methodB(MeineEntity entity); } @Local public interface TxMergeLocal {} @Remote public interface TxMergeRemote {} and the following SLSB: @Stateless public class TxMergeBean implements TxMergeRemote, TxMergeLocal { @PersistenceContext private EntityManager em; @EJB private TxMergeLocal self; @Resource private SessionContext sctx; public void methodA() { MeineEntity entity = new MeineEntity("methodA"); em....

March 14, 2013 · 4 min

Inject Java Properties in Java EE Using CDI

The aim of this post is to show you how, using CDI, you can inject Java properties entries (those in *.properties files) directly into your Java class. This is somewhat similar to the Spring’s @Value annotation I needed in my plain Java EE project. The whole code can be found on GitHub so feel free to clone it, use it or make any changes you like. Context Ok, so basically in a Java EE environment we already have a way to define some properties that are deployment-specific – it’s the <env-entry> element in the descriptor....

June 17, 2012 · 12 min

After the GeeCON 2012

Whoa, those few days of GeeCON – Polish Java conference – just passed way too quick. A lot of great speakers, pretty good organisation and the overwhelming Java climate. Yep, it’s geeky or even nerdy but – what the hell – me like it! ;-) But for all of you who was not able to attend this conference – it consisted of 3 parts: University Day (1 day), Conference (2 days), Open Spaces with Bruce Eckel (1 day)....

May 23, 2012 · 12 min

GlassFish Java DB not started

I’ve had some problem with starting the GlassFish database. It occurs that in GlassFish 3.1 it started together with the Application Server (when you started the domain), but this doesn’t work for me since 3.1.1. So, if you see something like: Error connecting to server localhost on port 1527 with message Connection refused: connect. you can try to start the GlassFish Java DB by yourself. To do this, just invoke:...

February 28, 2012 · 1 min