Hibernate Spatial makes managing spatial data through java code a breeze.  What hibernate-spatial provides is a standardized non- optimized layer that abstract the spatial data management engine.  Currently there are a few databases that supports spatial data management.  Granddaddy of this group is PostgreSQL.  Not so far behind is Oracle and SQL Server.  Very far behind but trying hard to catch up is MySQL.  MySQLs implementation is incomplete especially around spatial analysis functions


Currently, MySQL does not implement these functions according to the specification. Those that are implemented return the same result as the corresponding MBR-based functions.

Then the obvious question is “What is complete?” In this context complete is what is specified by the guys at Open Geospatial Consortium (OGC).  Hibernate spatial acknowledges that none of these databases are fully OGC compliant.  So it uses a clever mechanism to still provide a uniform API to the underlying spatial databases.  It uses a Provider that lets each databse specific provider to define its own ‘HibernateSpatialXXXXDialect’.  HibernateSpatialDialect invariably extends one of the Dialects provided by Hibernate.  So to a large extent it is hugely dependent on the twists and turns versions of Hibernate goes through.  At the same time it has always tried to keep itself as close to the curve as possible and have updated its versions matching to Hibernate’s.   Recently we shifted the spatial database from MySQL to Oracle.  This shift was painless because we used this spatial layer in between.  90% of the spatial code worked out of the box when I changed the provided from mysql to oracle.  The 10% of the code that did not work well was pertaining to data fetch back.   Investigation into these unearthed problems revealed some serious shortcomings of MySQL as a spatial data store.

It is interesting to note that spatial data management can be creatively used beyond GeoSpatial systems.  Geo spatial systems can be thought of as a specific use case of a family of problems dealing with annotated images with spatial relationship between various annotations.  These images can be of any type – for example a portrait, a scan of an architectural drawing, a digitized high resolution image of the solar system, images from molecular analysis of samples etc.  In one of the future posts I will discuss some ideas on how to creatively use spatial database for innovative solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation