maesenka/hibernate-core — pull request #3 by shane-axiom (2014-01-23 02:16:30+00:00)
Title: Cast and return object in geodb toJTS if its already a Geometry

While running some jUnit tests in a project that use an in-memory h2/geodb for testing, I ran into a situation where the object being passed to toJTS was already a Geometry. I'm not totally sure why this was happening (caching by h2?), but it seems logical to just cast and return the object if it's already a geometry. It might even make sense to put this in AbstractJTSGeometryValueExtractor as it seems applicable regardless of the provider.

At least one other person has run into this, although I'm not sure if they were using h2:

http://stackoverflow.com/questions/20214105/hibernate-spatial-illegal-argument-exception