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'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 <<a href="mailto:postgis@lists.meisel.cn">postgis@lists.meisel.cn</a>> 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>
        <property name="theGeom" type="org.hibernatespatial.GeometryUserType"><br>
            <column name="the_geom" /><br>
        </property><br>
<br>
----------------------------<br>
Class File<br>
<br>
import com.vividsolutions.jts.geom.Point;<br>
...<br>
        public class Grd<br>
<br>
        private Point   theGeom;<br>
<br>
        public Point getTheGeom() {<br>
                return this.theGeom;<br>
        }<br>
<br>
        public void setTheGeom(Point theGeom) {<br>
                this.theGeom = theGeom;<br>
        }<br>
-------------------------------<br>
<br>
hibernateTest.java<br>
<br>
<br>
                hibernateTest hbTest = new hibernateTest();<br>
<br>
                hbTest.createAndStoreEvent("POINT(12 14 15)");<br>
<br>
                HibernateUtil.getSessionFactory().close();<br>
<br>
                .........<br>
<br>
        private void createAndStoreEvent(String wktPoint) {<br>
<br>
                // First interpret the WKT string to a point<br>
                WKTReader fromText = new WKTReader();<br>
                Geometry geom = null;<br>
                try {<br>
                        geom = fromText.read(wktPoint);<br>
                }<br>
                catch (ParseException e) {<br>
                        throw new RuntimeException("Not a WKT string:" + wktPoint);<br>
                }<br>
                if (!geom.getGeometryType().equals("Point")) {<br>
                        throw new RuntimeException("Geometry must be a point. Got a " + geom.getGeometryType());<br>
                }<br>
<br>
                Session session = HibernateUtil.getSessionFactory().getCurrentSession();<br>
<br>
                session.beginTransaction();<br>
<br>
                Grd theGrd = new Grd();<br>
                Point p = (Point) geom;<br>
<br>
        // at this point there is an Z-Coordinate ///<br>
                System.out.println(p.getCoordinate().z);<br>
<br>
                theGrd.setTheGeom(p);<br>
<br>
                session.save(theGrd);<br>
<br>
                session.getTransaction().commit();<br>
<br>
                HibernateUtil.getSessionFactory().close();<br>
--------------------------<br>
<br>
After reading the Point from the DB using:<br>
<br>
        private List<Grd> findAll() {<br>
                Session session =<br>
                HibernateUtil.getSessionFactory().getCurrentSession();<br>
                session.beginTransaction();<br>
                Criteria testCriteria = session.createCriteria(Dgm050Grd.class);<br>
                List<Dgm050Grd> results = testCriteria.list();<br>
                session.getTransaction().commit();<br>
                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>