The current hibernate indexing method using pagination can be slow for large datasets and, in particular, slows down as the indexing progresses. There's a forum thread about it at
http://forums.opensymphony.com/thread.jspa?threadID=67326&tstart=0
.
I came up with an alternative indexing method using hibernates ScrollableResults solution which shows much better behaviour with large numbers of instances, and the code will be attached to this issue.
Here's the actual java file. Even though it is an inner class of AbstractHibernateGpsDevice I've included it here in its own java file.