Circumvent Nested Transaction Issues in Tapestry-5.x

Ajax component events may be wrapped in a transaction as I pointed out in “Transaction Handling for Ajax Components in Tapestry-5.x“. But on some occasions an Ajax component event is surrounded by a component event. So the code in the ControllerUtil of article “Transaction Handling in Tapestry5” will lead to ‘transaction already active’ problems, since we try to begin a transaction in the nested ajax component event although there is already an active transaction attached to the current thread. We can overcome this situation by checking, whether an active transaction is present and begin/commit/rollback a new transaction iff not. This behavior is similar to the default transaction attribute REQUIRED in Java EE.
Read More

Circular Injection of Util Classes in EJB 3.0

In my last post Circular Dependencies of Session Beans I presented a method to use interceptors in session beans in order to inject beans. This works great until you want to add circular dependencies. Then you have to look up the beans by name and inject them into the bean. But this is kind of cumbersome. So, if it is possible, have a bean structure, which is topologically sortable and inject util classes having circular dependencies between each other. This post shows how to achieve the latter.
Read More

Circular Dependencies of Session Beans

This post is about circular dependencies between session beans (ejb 3.0), which is ‘not possible’ without manual loading. The manual variant might be the solution of choice for you. Therefore, I will sketch it out later in this post. The first part of this post post is about a trial to achieve this with @EJB annotation only … which failed! But perhaps it will stop some of you to try it out (for nuts) and it’s a great bridge to a solution by a snatch enabling to have circular injection of ‘your own’ beans. I will show you the latter in my next post.
Read More

Menus with Icons in Ubuntu Karmic++

With the update to karmic koala ubuntu reversed the color scheme of context menus. Before the foreground had been dark and the background bright. Now, guess what, it’s the other way around. With this change, the property for showing icons in context menus has been disabled, too. This is due to transparency problems. Unfortunately, programs like eclipse make extensive use of this feature. So, not having these icons anymore is more than annoying.
Read More

Standalone Tomcat with jBoss (2nd Edition)

This tutorial desribes, how to install and configure a standalone Tomcat, so that a deployed webapp can connect to a jBoss and use the authentication of the application server. This method is decoupled from the login module or authentication type (LDAP, Database, …), respectively. It differs from the approach described in Standalone Tomcat with jBoss plus authentication against LDAP, in that it allows for parallel logged in users and it does not need to authenticate to LDAP/Database on both sides, but on the jBoss only.

Read More

The Cartesian Product Read Issue

Building up a project with a JPA persistence layer requires some design decisions from you. Although the abstraction layer is meant to relieve you from the pain working with a relational database, you have to keep in mind that everything you do with your entities has somehow to be translated to the underlying resource and is subject to its constraints. Often the abstraction layer even adds constraints, since the OR-Mapper has to be independent from the concrete implementation of your resource and therefore can only use the intersection of the different sets of functions. Furthermore there are general solutions to many common problems that might be a lot of slower than a specialized implementation in some cases. In the last posts I tried to give some hints and advices, how a persistence provider — especially hibernate — can be configured, in order to overcome many of this problems. Still, you have to decide beside plenty others, when to use lazy- and eager-fetching.
Read More

Unit Test Your Persistence Layer

This post is an addition to the post Unit Test Your DB Schema and Named Queries. It shows how to use the TestNG Annotations in order to simulate a lightweight EJB container enabling you to test your persistence layer (DAO, entity classes and similar). If you are using JBoss 6 you may use the embedded EB container. EJB3Unit supports testing Enterprise Beans, too. But I couldn’t get the latter to run smoothly and I do not use the former, yet. So if you are still tied to the old Java EE 5 world you might benefit form this solution.
Read More