[postgis-users] Hibernate with PostGIS
jan.syryn at trasys.be
Wed Nov 22 06:32:00 PST 2006
I am also doing a project with PostgresSQL/PostGIS and Hibernate.
In general: it seems that you are lacking a common knowledge of Hibernate in
general and that you problems are merely related to Hibernate than to
In a normal Hibernate situation, you don't need to create the database
schema automatically, so you should not use the property hbm2dll.auto.
I propose you leave it out of you config file.
You just create the Geometry column in your table of the DB.
Also, it is a good practice to add a constructor to your POJO objects This
helps of easely creating objects that need to persisted in the database
- make the geometry column nullable. With the correction of Dave you should
be able of doing so with the GeometryUserType.
- Add for exemple an extra 'name' field to your table.
- Try to add a line in your DB without the geometry column.
This way, you know a) your keygenerator works b) a session is well
intantiated c) transaction did work
- If this goes well, try to use the postgis component:
Geometry myGeom = factory.createGeometry();
HIH (I hope it helps),
PS: I am also using Spring. But this is not your problem. The use of Spring
only complicate the things. Try to get the thing fired as simple as
possible. Then start building things up from there.
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Sandeep
Sent: samedi 18 novembre 2006 15:54
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Hibernate with PostGIS
I think Hibernate cannot create that Geometry column automatically !!!
is it something to do with hbm2ddl.auto !!
I am able to ..get the geometry from a table with geometry column already
Norman -->> Would you like me to create a simple tutorial on how to use
Hibernate with Postgis ..your tutorial .. is not easy to understand ...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the postgis-users