我正在使用 PostgreSQL + PostGIS + Grails 4 + Geoserver + React + JTS 构建一个小型地理服务器。域类有一个com.vividsolutions.jts.geom.Point
映射到sqlType: 'geometry(Point,4326)'
. 当我搜索任何findBy...(...)
搜索时,我无法得到结果,因为它是不可能的deserialize
在 Grails 2.x 中我没有遇到这个问题。这是我 3 年来第一次在 Grails 中编程。
package ....
import com.vividsolutions.jts.geom.Point
class Aqop {
String pid
String pname
Float x
Float y
String srid
Point center
static mapping = {
table 'aqop'
version false
autoTimestamp false
cache true
id column: 'aqop_id'
pname column: 'pname', type: 'text', index: 'aqop_pname_idx'
pid column: 'pid', type: 'text', index: 'aqop_pid_idx'
x column: 'x'
y column: 'y'
srid column: 'srid', type: 'text'
center column: 'center', sqlType: 'geometry(Point,4326)'
}
static constraints = {
pname size: 1..128, unique: true
pid size: 1..64, unique: true
x nullable: false
y nullable: false
srid nullable: false, size: 1..64
}
}
这是错误消息:
org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:243)
at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:287)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:138)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:113)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:29)
at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:60)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:47)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:261)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:257)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:247)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:333)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:3018)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1752)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1678)
at org.hibernate.loader.Loader.getRow(Loader.java:1567)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:731)
at org.hibernate.loader.Loader.processResultSet(Loader.java:990)
at org.hibernate.loader.Loader.doQuery(Loader.java:948)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:340)
at org.hibernate.loader.Loader.doList(Loader.java:2695)
at org.hibernate.loader.Loader.doList(Loader.java:2678)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2512)
at org.hibernate.loader.Loader.list(Loader.java:2507)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:109)
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1972)
at org.hibernate.internal.CriteriaImpl.list(CriteriaImpl.java:370)
at org.grails.orm.hibernate.query.AbstractHibernateQuery.singleResultViaListCall(AbstractHibernateQuery.java:807)
at org.grails.orm.hibernate.query.AbstractHibernateQuery.singleResult(AbstractHibernateQuery.java:794)
at org.grails.datastore.gorm.finders.AbstractFindByFinder.invokeQuery(AbstractFindByFinder.java:35)
at org.grails.datastore.gorm.finders.AbstractFindByFinder$1.doInSession(AbstractFindByFinder.java:29)
at org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:319)
at org.grails.datastore.gorm.finders.AbstractFinder.execute(AbstractFinder.java:42)
....
我如何反序列化域对象?欢迎任何帮助,并提前致谢。