We're updating the issue view to help you get more done. 

Postgis geometry type for JTS geometrys not usable

Description

The following error is generated when trying to read a geometry field from the database.

Example class:

1 2 3 4 5 6 7 8 public class Demo { @Id private long id; private com.vividsolutions.jts.geom.Geometry geometry; ... }

Exception:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 java.lang.NumberFormatException: For input string: "SR" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at org.geolatte.geom.ByteBuffer.from(ByteBuffer.java:78) at org.hibernate.spatial.dialect.postgis.PGGeometryTypeDescriptor.toGeometry(PGGeometryTypeDescriptor.java:99) at org.hibernate.spatial.dialect.postgis.PGGeometryTypeDescriptor.access$000(PGGeometryTypeDescriptor.java:38) at org.hibernate.spatial.dialect.postgis.PGGeometryTypeDescriptor$2.doExtract(PGGeometryTypeDescriptor.java:77) at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:241) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:237) at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:227) at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:303) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2726) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1728) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1654) at org.hibernate.loader.Loader.getRow(Loader.java:1543) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:727) at org.hibernate.loader.Loader.processResultSet(Loader.java:972) at org.hibernate.loader.Loader.doQuery(Loader.java:930) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336) at org.hibernate.loader.Loader.doList(Loader.java:2611) at org.hibernate.loader.Loader.doList(Loader.java:2594) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2423) at org.hibernate.loader.Loader.list(Loader.java:2418) at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1705) at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:363)

Environment

hibernate-core, hibernate-spatial 5.0.2
postgresql 9.1-901-1.jdbc4
postgis-jdbc 1.5.2

Status

Assignee

Karel Maesen

Reporter

Peter Wischer

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.0.2
5.0.1

Priority

Blocker