Skip to content

The latest production version of Hibernate (3.0) was released yesterday. According to the Hibernate web site, this contains minor fixes and some new functionality including two new database dialects.

I’ve been using the 3.0RC1 since its release and found it to be stable. The change log to version 3.0 lists the bugs and new features added so I’d recommend people using Hibernate have a look at this and then upgrade.

I’ve recently needed to do some command line parsing. Instead of reinventing the wheel, I looked at the Apache Commons CLI library. This library seemed to do exactly what I wanted and was fairly easy to use.

One question though? Why does the standard Java runtime not have classes to deal with CLI arguments?

J2SE 5.0 gives developers a whole load of new features – too many to list here, but a complete list is given at http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html

Generics is one of the best new features that has been added to J2SE 5.0 and they are incredibly easy to use! So what is Generics? Well, to put it simply, Generics gives you type safety on collections, so you can create collections that will only hold a specific type. Furthermore, when you get an object out of a collection using Generics, you don’t need to cast it to the relevant type – this is done automatically for you. This is best shown with a small example.

// Declare an array list called items that can only hold strings.
Collection items = new ArrayList();

// Add a couple of strings to the collection.
items.add("String 1");
items.add("String 2");

// Declare a 'String' iterator to loop through the collection.
Iterator iter = items.iterator();
while (iter.hasNext()) {
    // Get a value from the collection - note there is no need to cast it.
    String value = iter.next();
    System.out.println(value);
}