Skip to content

{ Tag Archives } java

Best new feature in Eclipse 3.6 Helios

… is hidden away on the last tab of the Java Formatting Profile editor (Preferences -> Java -> Code Style -> Formatter -> Edit). They’ve finally (after nearly six years) added the ability to temporarily turn the code formatter off for a tricksy block that needs its own custom formatting. e.g.: // @formatter:off xml .append( [...]

Also tagged ,

NoSuchMethodError when running JUnit tests in Eclipse

This is worth a quick post as I couldn’t find a solution on Google and it took me an hour or two of fiddling. I have a Maven project, call it frontend-war, which contains the main service code for FuncNet. A unit test kept failing in Eclipse with NoSuchMethodError, one of my least favourite screw-ups [...]

Also tagged , ,

Help! Eclipse won’t believe I have Maven 2.2.1

I have a project (built from an AppFuse template) that requires Maven 2.2.1. So I upgraded to this (from 2.1.0) and set my path and my M2_HOME and MAVEN_HOME env variables. Then I ran mvn eclipse:eclipse and imported the project into Eclipse (Galileo). However, in the problems list for the project (and at the top [...]

Also tagged ,

RetriableTask — a generic wrapper for retrying operations in Java

A couple of times recently I’ve needed to write methods that retry up to n times if an error occurs, and surprisingly, couldn’t find any standard patterns to accomplish this on the web. So I wrote my own. All comments appreciated (there may well be massive holes in my logic but it works so far).

Also tagged ,

Execute SQL outside of a transaction in Hibernate

I hit upon a snag today — while PostgreSQL requires that certain maintenance commands (e.g. vacuum analyze) are executed outside of a transactional context, it’s actually quite hard to get at Hibernate’s underlying database connection directly. Each Session object has a connection() method which returns a JDBC connection object, but this actually turns out to [...]

Also tagged ,

IteratorReader — streaming character data from an iterator

Recently when plugging two components of a high-throughput web service together, I ran into a snag. One component (a data repository) exposes an Iterator for pulling XML-formatted records out of it one by one. The other (for serving SOAP response documents) needed, ideally, something that could be wrapped in a StreamSource — i.e. an InputStream [...]

Also tagged ,

Java web service frameworks — a brief survey

One of the current ongoing R&D projects at CATH is the development of a library of web services for both internal and external use. The first step in this process was the selection of a web service toolkit (or ‘stack’) to use, as there are several competing (and often mutually incompatible) frameworks available. This page [...]

Also tagged , , , , , ,

What’s wrong with Hibernate, #4

Hibernate is supposed to allow you to write queries and manipulate data in the normal Java idiom. Which is true up to a point, and that point is almost five years in the past, when Java introduced generics. Generics are absolutely standard practice in Java these days, and have been for two (nearly three) versions. [...]

Also tagged

What’s wrong with Hibernate, #3

Unfortunately, open-source projects above a certain size seem to become victims of their own success. Many other excellent OSS products like Guice or CXF have user-centred mailing lists that the developers also read. These developers are generally very willing to help out with problems, and the users — having been treated kindly when they started [...]

Also tagged

What’s wrong with Hibernate, #2

On the Hibernate website (and elsewhere), one of the touted advantages of Hibernate over roll-your-own SQL is: Hibernate Core for Java generates SQL for you, relieves you from manual JDBC result set handling and object conversion, and keeps your application portable to all SQL databases. Well, not exactly. Many functions in HQL (Hibernate Query Language) [...]

Also tagged