【发布时间】:2016-01-13 08:23:37
【问题描述】:
我正在使用使用 spring 3.1 和 hibernate 4.2 的应用程序。对于空间特征,我们计划使用带有 postgis 的休眠空间。但是休眠空间会创建具有 bytea 类型而不是几何形状的列。我无法找出造成这种情况的根本原因在哪里。我已经花了几天时间解决但没有成功。
使用hibernate-spatial-4.0.jar。
我正在使用以下 hibernate.properties 文件
database.driverClassName=org.postgresql.Driver
database.url=jdbc:postgresql://127.0.0.1:5433/mpdb
database.username=postgres
database.password=postgres
hibernate.dialect=org.hibernate.spatial.dialect.postgis.PostgisDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=update
我在实体中使用以下注释
@Column(columnDefinition="Geometry", nullable = true)
@Type(type = "org.hibernate.spatial.GeometryType")
private Point geom;
应用程序成功创建了下表,但它为列 geom 创建了 bytea,而不是几何类型
Table "public.tile"
Column | Type | Modifiers
----------------------------+-----------------------------+-----------
id | integer | not null
alt | double precision | not null
geom | bytea |
lat | double precision | not null
lng | double precision | not null
multipath_table | text | not null
multipath_table_min_value | double precision |
multipath_table_resolution | integer |
multipath_table_tx_id | text |
tile_created | timestamp without time zone | not null
tile_data_age | integer |
tile_data_present | text | not null
tile_num_tx | integer |
Indexes:
"tile_pkey" PRIMARY KEY, btree (id)
但是我可以手动在 postgis2.2-postgres9.5 数据库中创建几何类型列
我几乎经历了每一个线程,但没有成功。需要帮助。
【问题讨论】: