Hibernate version: 2.1
Hiya all.. Perhaps this should go to the development list, I'm not sure. Apologies if the posting is in the wrong place.
I'm working on a project that needs to store spatial data indexed with spatial indexes. I'm currently working with MySQL, although in the past I've worked on Oracle Spatial databases too. I would like to be able to store values of a class such as Point and Polygon in the database.
Now, I'm aware that SQL-TYPE probably holds a short-term solution for me :) but I was wondering about the possibility of a longer term more complete solution to the problem. At first, I thought UserType might be the way to go, but I'm not sure what SQL Type the column would actually map on to (I've Seen GEOMETRY listed as a type but suspect it's always a local hack) or how to get the right function-wrappers called from the SQL. In MySQL the create table needs to be given a custom type (example below). At Insert/Select/Update time most of the access to the column is via a set of custom functions (MySQL functions being different to the Oracle ones, of course) that convert a string of comma seperated numbers into a hidden internal binary type. It feels to me like there is a need for an Abstract set of Geometry classes and then some extensions to the dialect mechanism to get the right function expressions for manipulating these columns in the database. It seems like the OpenGIS consortium has done a reasonable job of laying down the object model, it's essence is described quite nicely here:
http://dev.mysql.com/doc/mysql/en/GIS_g ... archy.html.
Just for reference, an example of a create table with spatial data for oracle would be
CREATE TABLE mylake (
feature_id NUMBER PRIMARY KEY,
name VARCHAR2(32),
shape MDSYS.SDO_GEOMETRY);
Wheras the MySQL one is more like
CREATE TABLE mylake (
feature_id NUMBER PRIMARY KEY,
name VARCHAR2(32),
shape GEOMETRY);
Now, this isn't something I need right away, but it's something I'd be interested in looking into if nobody else is looking at it. Anyone think this is really dumb / good idea?
Cheers for your time,
Ian.