[postgis-users] PostGIS - hibernate - EJB3

Norman Barker nbarker at ittvis.com
Mon Aug 7 08:08:54 PDT 2006


Hi,

I am trying to use EJB3 in Java JBoss (which is hibernate behind the
scenes),

I have marked up a property as follows 

	@Column(name="extents")
	public Geometry getExtents()
	{
		return extents;	
	}

And my data source looks like

<datasources>
  <local-tx-datasource>
    <jndi-name>GeoDataDS</jndi-name>
 
<connection-url>jdbc:postgresql://127.0.0.1:5432/geometa</connection-url
>
    <driver-class>org.postgis.DriverWrapper</driver-class>
    <user-name>xxx</user-name>
    <password>xxx</password>
      <metadata>
         <type-mapping>PostgreSQL 8.1</type-mapping>
      </metadata>
  </local-tx-datasource>
</datasources>

Where extents is of type org.postgis.Geometry, when I tell the
entityManager to commit this I get invalid geometry error even when I
commit an empty polygon, or  simple linestring such as 

LineString ls = new LineString("LINESTRING(191232 243118,191108
243242)");

If anyone has done this with EJB3 I would be really grateful for some
advice, but if you have done it with hibernate I would also be
interested as they are pretty similar.

Many thanks,

Norman



More information about the postgis-users mailing list