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

Script Your Remote Session Beans with Groovy

A JavaEE application with a multi-tier application generally has a presentation layer running in a servlet engine, a business logic layer running in a EJB container and a persistence layer facilitating JPA. During the development often there are occasions where a new functionality in the business logic (called backend from now on), which has no corresponding code in the presentation layer (let’s name it frontend), yet. So, what you need is a way to try out your code. This post shows you how to use the groovy shell to connect via JNDI to your remote session beans and call them in order to test your application fast. You may use it for a fast monitoring or maintenance API to your system, too. The groovy code of your efforts to test your code (monitor your application) may even be read from the history of the groovy shell and compiled into byte code. This code may be called from a test case or in a monitoring software (like nagios).
Read More