问题
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.
If I take the create table statement and execute it in pgadmin it works find so I think that the database is setup correctly.
My Versions:
postgres - 9.0 64Bit
postgis - 2.0.1 64Bit
hibernate-spatial - 4.0-M1
hibernate - 4.0.0-Final
postgis-jdbc - 1.5.2
Thx for help
JayBee
回答1:
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
来源:https://stackoverflow.com/questions/14518130/type-geometry-not-found-with-postgis-and-hibernate-spatial