我正在使用使用spring 3.1和hibernate 4.2的应用程序。对于空间特征,我们计划在postgis中使用hibernate空间。但hibernate空间使用bytea类型而不是几何创建列。我无法找出这是什么根源。我已经花了几天的时间来解决但并不成功。hibernate-spatial-4.0创建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
I am using following annotation in Entity
@Column(columnDefinition="Geometry", nullable = true)
@Type(type = "org.hibernate.spatial.GeometryType")
private Point geom;
申请成功创建如下表但不是几何类型它列GEOM
Table "public.tile"
Column | Type | Modifiers
创建BYTEA -------- -------------------- + ----------------------------- + ----------- id |整数|不为空 alt |双精度| not null geom | bytea | lat |双精度|非空 lng |双精度| not null multipath_table |文字| not null multipath_table_min_value |双精度| multipath_table_resolution |整数| multipath_table_tx_id |文字| tile_created |没有时区的时间戳| not null tile_data_age |整数| tile_data_present |文字| not null tile_num_tx |整数| 索引: “tile_pkey”主键,B树(ID)
但是手动我能够在postgis2.2-postgres9.5数据库中创建几何类型列
我几乎每一个线程,但不成功的经历。需要帮忙。