Java “Losing its Mojo?” I Think Not!

Wired has an article titled Is Java Losing Its Mojo? While the article seems to contradict itself in some ways, I have to take issue with the general theme. As someone who pays attention, I simply haven’t seen this happening. On the contrary–It seems to me that Java continues to grow. Just peruse the job… Continue reading Java “Losing its Mojo?” I Think Not!

Java 8/Lambas

ZeroTurnaround has a post about lamba expressions in Java 8 with some examples. Really cool. That last time I even really heard of a lambda expression was in college while briefly learning Lisp. Lambda expressions can be tried out now for anyone wishing to take a look. I’ll be trying it out when I have… Continue reading Java 8/Lambas

The Diamond Problem

The Diamond Problem “Fun” with multiple inheritance: Multiple inheritance – Wikipedia, the free encyclopedia Programmer Interview: What is the diamond problem? Does it exist in Java? (nope)

Apache Commons Configuration with JBoss 5

Here’s a problem that frustrated me for a bit: When using Apache Commons Configuration under JBoss 5, I kept running into the following error when attempting to save to my configuration file (which was a resource under the deployed /classes path): ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/xxxx].[xxxx]] (http-0.0.0.0-8080-1) Servlet.service() for servlet flint threw exception java.net.UnknownServiceException: protocol doesn’t support output… Continue reading Apache Commons Configuration with JBoss 5

JBoss Deployment Gotchas

The other day I was attempting to deploy a web app in JBoss (5.1) that had deployed just fine in Tomcat. In JBoss I kept seeing the following error: java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence cannot be cast to javax.persistence.spi.PersistenceProvider It turns out that the problem was because JBoss was first loading its own Hibernate classes. When my application… Continue reading JBoss Deployment Gotchas

Why I Dislike the @author Annotation

Here’s why I LOVE the @author annotation (in Javadoc comments): It makes me look really good having my name on tons of code. It shows that I am a high-output engineer. Here’s why I HATE the @author annotation: It implies some sort of ownership of a method, class or package to the rest of the… Continue reading Why I Dislike the @author Annotation

A Bidirectional Add-To-List Mistake

Here’s a somewhat real-world example of a bad coding practice. When setting up bidirectional relationships, its important to remember that the add methods for adding to a list that results in a one-to-many and many-to-one relationship set the parent/child relationship in both directions. To make life simple, I like to provide a couple of different… Continue reading A Bidirectional Add-To-List Mistake

Is there ever a reason NOT to use an Artificial Primary Key?

I found this post on the subject of choosing a primary key. While Java Persistence Annotations allow us to use any field we want as a primary key (as long as it is naturally unique), is there a good reason to use anything that is not a surrogate/artificial primary key? There are plenty of fine… Continue reading Is there ever a reason NOT to use an Artificial Primary Key?

Valuable Unit Tests in a Software Medical Device, Part 9

I thought I was done, but here is yet another good reason to incorporate complex function automated testing: Validation of multiple Java runtime environments. Fabrizio Giudici proposes this as a solution for testing with Java 7, but we can always take it a step further, verifying multiple OS environments as well. Of course, this requires… Continue reading Valuable Unit Tests in a Software Medical Device, Part 9

Where Do Hibernate Transactions Fit In?

I recently got into a discussion on where Hibernate transactions should be placed in the scope of DAO logic. Some people have a desire to begin and end a transaction inside a DAO method. This is really a question of unit of work, and not scope of the DAO. Let’s say we have a single… Continue reading Where Do Hibernate Transactions Fit In?

Hibernate: All Entities Must Have an Id–And All Tables Should Be Entities!

Sometimes the relational database designer in me sometimes wants to create a table with multiple columns without a primary key (i.e., only a foreign key lookup . An example of when this might be appropriate is when some parent data type had many attributes that don’t necessarily need to be persisted as unique entities (any… Continue reading Hibernate: All Entities Must Have an Id–And All Tables Should Be Entities!