<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>Hi Sandeep,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>I am also doing a project with PostgresSQL/PostGIS and
Hibernate.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>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 PostGIS.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>In a normal Hibernate situation, you don't need to create
the database schema automatically, so you should not use the property
hbm2dll.auto.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>I propose you leave it out of you config
file.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>You just create the Geometry column in your table of the
DB.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>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 </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>Little suggestion: </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>- make the geometry column
nullable. </FONT></SPAN><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>With the correction of Dave you should be able of doing so
with the GeometryUserType.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>- Add for exemple an extra 'name' field to your
table.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>- Try to add a line in your DB without the geometry column.
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial><FONT
color=#0000ff size=2>for exemple: </FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial><FONT
color=#0000ff size=2> session.save(new
RoadNetwork("sandeep"))</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>This way, you know a) your keygenerator works b) a session
is well intantiated c) transaction did work</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>- If this goes well, try to use the postgis
component:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2> Geometry myGeom =
factory.createGeometry();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2> session.save(new
RoadNetwork("sandeep",myGeom))</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>HIH (I hope it helps), </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>Jan</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=285381414-22112006><FONT face=Arial
color=#0000ff size=2>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.</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of
</B>Sandeep Kumar Jakkaraju<BR><B>Sent:</B> samedi 18 novembre 2006
15:54<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re:
[postgis-users] Hibernate with PostGIS<BR></FONT><BR></DIV>
<DIV></DIV><BR>I think Hibernate cannot create that Geometry column
automatically !!! <BR>is it something to do with hbm2ddl.auto !! <BR><BR><BR>I
am able to ..get the geometry from a table with geometry column already created
...<BR><BR>Norman -->> Would you like me to create a simple tutorial on
how to use Hibernate with Postgis ..your tutorial .. is not easy to understand
...<BR><BR><BR>Thanks<BR>Sandeep<BR><BR><BR><BR></BODY></HTML>