Postgis和Hibernate-Spatial找不到类型的几何体 [英] Type geometry not found with postgis and hibernate-spatial

查看:227
本文介绍了Postgis和Hibernate-Spatial找不到类型的几何体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用postgis设置具有休眠空间的项目.在针对休眠空间4.0-M1的教程之后,我首先遇到了找不到依赖项postgis-jdbc-1.5.3.jar的问题.就像有人在这里建议的那样,我使用了1.5.2版,并且该教程进行了编译.

I'm trying to setup a project with hibernate-spatial using postgis. Following the tutorial for hibernate-spatial 4.0-M1 I first run into the problem that the dependency postgis-jdbc-1.5.3.jar couldn't be found. Like suggested here by somebody I used the version 1.5.2 and the tutorial compiles.

但是,如果我尝试运行它,则会收到错误消息.我将休眠的调试级别设置为调试,并偶然遇到以下问题:

But I got an error if I try to run it. I set the debug-level for hibernate to debug und stumbled upon the following problem:

DEBUG SQL -
create table Event (
    id int8 not null,
    date timestamp,
    location GEOMETRY,
    title varchar(255),
    primary key (id)
)
Hibernate:
create table Event (
    id int8 not null,
    date timestamp,
    location GEOMETRY,
    title varchar(255),
    primary key (id)
)
ERROR SchemaExport - HHH000389: Unsuccessful: create table Event (id int8 not null, date timestamp, location GEOMETRY, title varchar(255), primary key (id))
ERROR SchemaExport - FEHLER: Typ ╗geometry½ existiert nicht  Position: 94

该错误是德语,但表示几何"类型不存在.

The error is german but means, that the type 'geometry' does not exist.

如果我使用create table语句并在pgadmin中执行它,那么它可以正常工作,因此我认为数据库设置正确.

If I take the create table statement and execute it in pgadmin it works find so I think that the database is setup correctly.

我的版本:

postgres          - 9.0     64Bit
postgis           - 2.0.1   64Bit
hibernate-spatial - 4.0-M1
hibernate         - 4.0.0-Final
postgis-jdbc      - 1.5.2

寻求帮助

JayBee

推荐答案

您的Postgresql不支持几何.您需要向其添加postgis扩展名以创建空间数据库.因此,可以从此处下载适合您的Postgres的Postgis扩展名.然后将其完全安装在postgresql安装文件夹中,例如(在我的系统中)以下路径:

Your Postgresql does not support geometry. You need to add postgis extension to it in order to create spatial databases. So download suitable postgis extension for your postgresql from here. Then install it in the postgresql installation folder exactly, for example (in my system) in the following path:

 C:\Program Files (x86)\OpenGeo\OpenGeo Suite\pgsql\9.1

这篇关于Postgis和Hibernate-Spatial找不到类型的几何体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆