<DIV><FONT face=Arial size=2>Christian,</FONT></DIV> <DIV><FONT face=Arial size=2>I'm using the 'DriverWrapper' in the org.postgis package instead of the regular 'org.postgresql.Driver'. So in my postgres-ds.xml I have:</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2><driver-class>org.postgis.DriverWrapper</driver-class></FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Also, after creating my 'Geometry' object I was required to set the 'srid' field, like this:</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2><FONT face="Times New Roman" size=3>double x = 10.50;<BR>double y = 8.20;<BR>Geometry geometry = new org.postgis.Point(x,y);</FONT><BR><FONT face="Times New Roman" size=3>geometry.setSrid(4326);</FONT></FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Otherwise, I kept getting errors
when trying to persist the object into the database. </FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>I hope this helps.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Thanks,</FONT></DIV> <DIV><FONT face=Arial size=2>Daniel</FONT></DIV><BR><BR><B><I>coster <christian.osterrieder@salzburgresearch.at></I></B> wrote: <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR>Hallo Daniel,<BR>thank you for your solution, it works fine for me.<BR><BR>But there is another problem:<BR>If I try to store my geometry data I get the following error:<BR>Caused by: org.postgresql.util.PSQLException: Unzulässiger Wert für den Typ<BR>int :
010100000000000000000025406666666666662040.<BR>at<BR>org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2507)<BR>at<BR>org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:1994)<BR>at org.postgresql.jdbc3.Jdbc3ResultSet.getBlob(Jdbc3ResultSet.java:54)<BR>at<BR>org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBlob(AbstractJdbc2ResultSet.java:323)<BR>at<BR>org.jboss.resource.adapter.jdbc.WrappedResultSet.getBlob(WrappedResultSet.java:378)<BR>at<BR>at.srfg.dataAccessLayer.persistance.hibernate.GeometryType.nullSafeGet(GeometryType.java:63)<BR><BR>I use a simple Point for testing it:<BR>double x = 10.50;<BR>double y = 8.20;<BR>Geometry geometry = new org.postgis.Point(x,y);<BR><BR>Thank you for your help,<BR>Christian.<BR><BR><BR>D. Martinez wrote:<BR>> <BR>> Hello, <BR>> I implemented Norman's solution and got the same problem, with the column<BR>> getting defined as 'oid' instead of 'geometry'. <BR>> I finally
found a fix that worked for me. It's actually very simple. All I<BR>> do is set a 'columnDefinition' for the field in the EJB entity bean. Like<BR>> this. <BR>> <BR>> @Type(type="mycode.ejb.par.GeometryType") <BR>> @Column(name="LOCATION",columnDefinition="geometry") <BR>> public org.postgis.Geometry getPoint() { <BR>> return _point; <BR>> } <BR>> <BR>> I set the 'columnDefinition' to 'geometry', and it seems to work. The<BR>> column gets created as type 'geometry'. <BR>> <BR>> Hope this helps. <BR>> <BR>> Norman, thanks for your solution! <BR>> <BR>> Daniel <BR>> <BR>> <BR>> <BR>> ---------------------------------<BR>> Do you Yahoo!?<BR>> Get on board. You're invited to try the new Yahoo! Mail.<BR>> _______________________________________________<BR>> postgis-users mailing list<BR>> postgis-users@postgis.refractions.net<BR>>
http://postgis.refractions.net/mailman/listinfo/postgis-users<BR>> <BR>> <BR><BR>-- <BR>View this message in context: http://www.nabble.com/PostGIS---hibernate---EJB3-tf2064211.html#a6244904<BR>Sent from the PostGIS - User forum at Nabble.com.<BR><BR>_______________________________________________<BR>postgis-users mailing list<BR>postgis-users@postgis.refractions.net<BR>http://postgis.refractions.net/mailman/listinfo/postgis-users<BR></BLOCKQUOTE><BR><p>
<hr size=1>Stay in the know. Pulse on the new Yahoo.com. <a href="http://us.rd.yahoo.com/evt=42974/*http://www.yahoo.com/preview"> Check it out.</a>