Archive for the ‘Java’ Category

Statically weaving JPA entities for EclipseLink using Maven

EclipseLink provides advanced JPA features such as lazy-loading, change tracking and fetch groups using bytecode weaving. To use bytecode weaving you can either dynamically instrument your entity classes at runtime (via a jvm agent) or use a tool to statically process the .class files after compilation. In this post we will present how to use [...]

Using EclipseLink with Maven

The EclipseLink/Maven wiki page of the EclipseLink project has information on how to setup your Maven dependencies in order to use EclipseLink in a Maven based project. The problem with that page is that it contains typos in all artifactIds of the OSGi enabled artifacts. For example the page lists org.eclipse.peristence.jpa as the artifactId of [...]

Using Dependency Injection in Struts2 for stateless EJBs part 2

This is the second, and last part of the Using Dependency Injection in Struts2 for stateless EJBs series of posts. In this post I will present a utility class that can be used to make the creation of Guice bindings for EJB3s easier. Introducing EjbBinder Our goal is to make an easier API, specifically for [...]

Using Dependency Injection in Struts2 for stateless EJBs part 1

In this post I will present a way to use dependency injection of stateless session beans in Struts 2 actions using Guice. I will only write about EJB3, because they have simpler client lookup code, but you might be able to change the presented code to cover older versions of EJB. We will use off [...]

C# Extension methods

Scott Hanselman has a post about a user who doesn’t get what is cool about Ruby. In the post you can find the below example that compares Java and Ruby in terms of code readability. The Java code: new Date(new Date().getTime() – 20 * 60 * 1000) The Ruby code: 20.minutes.ago The article was interesting [...]