-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to map MySql GEOMETRY to Hibernate?
PostPosted: Sat Aug 20, 2005 10:15 am 
Newbie

Joined: Mon Jun 06, 2005 8:21 am
Posts: 13
How can I map a GEOMETRY column type to Hibernate?

Currently I'm doing INSERT/DELETE/ operations on this sql type using java.sql.Connection and PreparedStatement classes.

Hibernate version:
2.1.7.c

Name and version of the database you are using:
MySql 4.1.12 Win


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 20, 2005 1:15 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
I am not sure about built in support for GEOMETRY, but have you tried inplementing this?

http://www.hibernate.org/hib_docs/api/n ... rType.html


Top
 Profile  
 
 Post subject:
PostPosted: Sun Aug 21, 2005 3:08 am 
Newbie

Joined: Mon Jun 06, 2005 8:21 am
Posts: 13
Thanks for your suggestion but I'm still not convinced if I really can use UserType.

Normal insertion of GEOMETRY data:

Code:
INSERT INTO Coordinates  VALUES (Geomfromtext('point(1 1)') );

Retrieval:

Code:
SELECT Y(GeomFromText(AsText(coordinate))) AS lat, X(GeomFromText(AsText(coordinate))) AS lon, ROUND(GLength(LineStringFromWKB(LineString(AsBinary(coordinate), POINT(89.6, 25.98))))) AS distance FROM Coordinate


I have to in some way combine this custom sql query and the UserType.
Is this achievable?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.