[postgis-users] Hibernate with PostGIS
Sandeep Kumar Jakkaraju
sandeepkumar.jakkaraju at gmail.com
Wed Nov 22 07:10:28 PST 2006
Hello Jan ..
Thanks for ur reply .. u r right i am newbie in Hibernate and Spring !!
I thought that creating table schema automatically is a GOOD feature of
If your application is using some tables .. u create those tables in your db
but when u want to use some other db ..u have to send all the sql scripts
with schema.. and some has to run it ...to create the table schemas...
But If you u r using hibernate ...there is no need for this ..because it
automatically creates the table schemas ..
Please correct do me ..if my argument is wrong ..
With Hibernate-PostGIS .. it is not able to create the Geometry column
automatically .. i thought it was BUG which needed attention .. so i posted
I have no other problem with using Hibernate with postgis ....
I really appreciate ur other suggestions as well..
On 11/22/06, Jan Syryn <jan.syryn at trasys.be> wrote:
> Hi Sandeep,
> 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
> Little suggestion:
> - 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.
> for exemple:
> session.save(new RoadNetwork("sandeep"))
> 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();
> session.save(new RoadNetwork("sandeep",myGeom))
> 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
> Kumar Jakkaraju
> *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
> created ...
> Norman -->> Would you like me to create a simple tutorial on how to use
> Hibernate with Postgis ..your tutorial .. is not easy to understand ...
> postgis-users mailing list
> postgis-users at postgis.refractions.net
Sandeep Kumar Jakkaraju
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the postgis-users