Hi Max,<br><br>What is your schema? Is hibernate creating it for you or are you creating it for hibernate?<br><br>And if that is the WKTReader from VividSolutions, then you&#39;ll notice at: <a href="http://www.vividsolutions.com/JTS/JTSHome.htm">http://www.vividsolutions.com/JTS/JTSHome.htm</a> that the API only handles 2D.<br>
<br>HTH<br><br>Drew<br><br><div class="gmail_quote">On Thu, May 8, 2008 at 1:04 AM, Max &lt;<a href="mailto:postgis@lists.meisel.cn">postgis@lists.meisel.cn</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
<br>
first i want to thank Karel for the great hibernate-spatial extension.<br>
Using this extension saves a lot of time.<br>
<br>
These days i got the new sources from the svn, because i saw that Karel<br>
was implementing the 3D stuff for the postgis-provider. So far so good.<br>
<br>
After compiling and using the new provider i found out, that it doesnt<br>
work for me, so maybe someone can help me to solve the problem. Writing<br>
a 3D point to the postgis-db still returns a 2D point, so i dont know<br>
whats wrong.<br>
<br>
My files are looking like this (parts - taken from hibernate spatial<br>
example)):<br>
<br>
----------------------------<br>
...hmb.xml<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;property name=&quot;theGeom&quot; type=&quot;org.hibernatespatial.GeometryUserType&quot;&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;column name=&quot;the_geom&quot; /&gt;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;&lt;/property&gt;<br>
<br>
----------------------------<br>
Class File<br>
<br>
import com.vividsolutions.jts.geom.Point;<br>
...<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public class Grd<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private Point &nbsp; theGeom;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public Point getTheGeom() {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return this.theGeom;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;public void setTheGeom(Point theGeom) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.theGeom = theGeom;<br>
 &nbsp; &nbsp; &nbsp; &nbsp;}<br>
-------------------------------<br>
<br>
hibernateTest.java<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hibernateTest hbTest = new hibernateTest();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hbTest.createAndStoreEvent(&quot;POINT(12 14 15)&quot;);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HibernateUtil.getSessionFactory().close();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.........<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private void createAndStoreEvent(String wktPoint) {<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;// First interpret the WKT string to a point<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;WKTReader fromText = new WKTReader();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Geometry geom = null;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;try {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;geom = fromText.read(wktPoint);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;catch (ParseException e) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;throw new RuntimeException(&quot;Not a WKT string:&quot; + wktPoint);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!geom.getGeometryType().equals(&quot;Point&quot;)) {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;throw new RuntimeException(&quot;Geometry must be a point. Got a &quot; + geom.getGeometryType());<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Session session = HibernateUtil.getSessionFactory().getCurrentSession();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.beginTransaction();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Grd theGrd = new Grd();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Point p = (Point) geom;<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;// at this point there is an Z-Coordinate ///<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(p.getCoordinate().z);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;theGrd.setTheGeom(p);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.save(theGrd);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.getTransaction().commit();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HibernateUtil.getSessionFactory().close();<br>
--------------------------<br>
<br>
After reading the Point from the DB using:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;private List&lt;Grd&gt; findAll() {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Session session =<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HibernateUtil.getSessionFactory().getCurrentSession();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.beginTransaction();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Criteria testCriteria = session.createCriteria(Dgm050Grd.class);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;List&lt;Dgm050Grd&gt; results = testCriteria.list();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;session.getTransaction().commit();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return results;<br>
<br>
// the Point has not Z-Coordinate, its just NaN<br>
<br>
So whats wrong? I know to appreciate your hekp<br>
<br>
<br>
best regards<br>
<br>
Steffen<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br>