Posted in November 23, 2011 ¬ 19:52h.Piotr
Sometimes you need to pass some additional / contextual data to the called EJB method. Because it’s a contextual data you don’t want to end in changing signatures of all your EJB methods just to add a single or few such parameters. It is possible to add context data using the SessionContext object. 1 person [...]
Read the rest of this entry »
Posted in November 23, 2011 ¬ 18:32h.Piotr
Recently, I’ve bumped into few posts on StackOverflow where people tend to compare container managed EntityManager instances (so the one injected by the container) by invoking EntityManager#toString() method. I’ve felt that it’s fundamentally wrong to compare EntityManager instances without knowing how they’re managed by the JPA provider or the Server Application. And what if this [...]
Read the rest of this entry »
Posted in September 1, 2011 ¬ 10:42h.Piotr
You probably know that if you use BMT (Bean Managed Transactions) you can get information about current transaction status by using UserTransaction interface (which implementation can be fetched either by JNDI or using dependency injection) and executing it’s getStatus() method. If you use CMT (Container Managed Transactions) you cannot use UserTransaction interface. Instead, you can [...]
Read the rest of this entry »
EJB, Javabmt, cmt, dependency injection, EJB, java, jndi, status, transactions, transactionsynchronizationregistry, usertransaction
Posted in August 31, 2011 ¬ 10:44h.Piotr
Just a note to myself – always check what classes are you importing in IDE, because if you see @Singleton in your class, it doesn’t mean it will work as a EJB Singleton. In my case it wasn’t referencing to javax.ejb.Singleton as I assumed, but com.sun.jersey.spi.resource.Singleton… Wasted 2 hours of looking for the answer or [...]
Read the rest of this entry »
Posted in June 13, 2011 ¬ 18:30h.Piotr
If you want to add your classes (or any other resources) to your ShrinkWrap archive to a non-root location, you can use the following: @Deployment public static JavaArchive deploy() { // This is the classes and resources archive JavaArchive ar; ar = ShrinkWrap.create(JavaArchive.class, “resources.jar”) .addPackage(TestClass.class.getPackage()); /* * The ‘ar’ archive will be added to [...]
Read the rest of this entry »
Posted in June 13, 2011 ¬ 18:16h.Piotr
When you create a deployment using Arquillian (great test runner for testing your Java EE code in the container of your choice: jBoss, Glassfish, OpenEJB, … either in embedded, managed or remote mode) remember that the name of the deployment archive file is the exact filename that will be executed in the container. It does [...]
Read the rest of this entry »
Posted in May 19, 2011 ¬ 19:17h.Piotr
Just a letter to my future self: When you use Properties and creates the entries, remember to avoid the whitespaces. The properties are inserted as-they-are, so no trimming occurs. It might sound trivial, but it wasted at least an hour of my time, while I was searching for a bug in a totally wrong department… [...]
Read the rest of this entry »
Posted in May 19, 2011 ¬ 19:10h.Piotr
Pretty useful thing about the Java classpath definition is that the wildcard (“*”) can be used in a replacement of all *.jar and *.JAR files in the specified directory. So the following line: java -cp /tmp/app/*:/tmp/myJar.jar com.nullhaus.MyApp will add the /tmp/myJar.jar to the classpath, as well as all the *.jar and *.JAR files in the [...]
Read the rest of this entry »
Posted in April 24, 2011 ¬ 14:03h.Piotr
I was trying to execute several commands on a single record found by the GNU/Linux find command. The first attempt was to create something like: find . -name “*.pdf” -exec echo ‘test’ && echo ‘test2′ \; But it’s not the way the find command works. 1 person likes this post. Like Unlike
Read the rest of this entry »
Posted in March 27, 2011 ¬ 22:00h.Piotr
This test might help to test your knowledge before taking the Oracle Certified Expert, JEE 6: JSP and Servlet Developer Exam. Note that there are some well-designed and good quality SCWCD 5 mock exams already available on the net. However, the below questions, focus mainly on the new features which comes along with the Servlets [...]
Read the rest of this entry »
Javacertification, exam, glassfish, java, jee, jee 6, mock, oracle, resin, scwcd, sevlets, tomcat