【发布时间】:2015-01-31 14:29:17
【问题描述】:
我想使用休眠空间来处理我的空间对象。我正在使用hibernate-spatial-4.0.1 和hibernate 4.2。我的方言:
<property name="hibernate.dialect"> org.hibernate.spatial.dialect.postgis.PostgisDialect</property>
我有一个这样的实体:
@Entity
@DiscriminatorValue(CK.LAYER_PICTURES)
public class PicsLayerItem extends LayerItem {
@Column(name = "place_name")
private String placeName;
public void setPlaceName(String name) {
this.placeName = name;
}
public String getPlaceName() {
return this.placeName;
}
@Type(type = "org.hibernate.spatial.GeometryType")
@Column(name = "locations", nullable = true)
private LineString locations;
public LineString getLocations() {
return locations;
}
}
hibernate更新schema时遇到这个错误的问题:
ERROR [http-nio-8084-exec-53] org.hibernate.tool.hbm2ddl.SchemaUpdate.execute HHH000388: Unsuccessful: alter table public.tree_item add column locations GEOMETRY
ERROR [http-nio-8084-exec-53] org.hibernate.tool.hbm2ddl.SchemaUpdate.execute ERROR: type "geometry" does not exist
我猜我的 postgresql 不支持几何类型。我使用 PgAdminIII。它是postgis。它支持polygon 等数据类型。
我能做些什么来解决这个问题?
没有答案的类似问题:Type geometry not found with postgis and hibernate-spatial
【问题讨论】:
标签: java hibernate geometry hibernate-mapping postgis