<!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=664300617-22112006><FONT face=Arial
color=#0000ff size=2>Yes indeed, Hibernate has the possibility to create a
schema for you.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><FONT face=Arial
color=#0000ff size=2>And yes, it is practical, I used it
also.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><FONT face=Arial
color=#0000ff size=2>But the problem is, it is not well
done.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><FONT face=Arial
color=#0000ff size=2>For example: the name of the PK en FK indices are random.
Not nice if you have a fk144524524541 contraint exception </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><FONT face=Arial
color=#0000ff size=2>Also when you execute your code, you will also loose all
your data already inserted before. (he creates new tables).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>So I used it
once, cleaned the schema and never uses it again.</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>What is your
status exactly ? Do you succeed in inserting an object (without PostGis data)
into your DB ?</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>It is possible
(and probably true) that Hibernate is not capable of creating a Geometry column
itself.</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>But what is the
use or benefit ? Very limited.</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>Like I said:
</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>- make a working
version without Geometry (with the auto-creation feature if you want).
</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>- remove the
auto-creating feature</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>- Add a column
yourself in db that is of type Geometry</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>- try to insert a
POJO that also contains the Geometry.</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff size=2>Try to keep it
simple !</FONT></SPAN></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff
size=2></FONT></SPAN></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=664300617-22112006><SPAN
class=664300617-22112006><FONT face=Arial color=#0000ff
size=2>Jan</FONT></SPAN></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> mercredi 22 novembre 2006
16:10<BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B> Re:
[postgis-users] Hibernate with PostGIS<BR></FONT><BR></DIV>
<DIV></DIV>Hello Jan ..<BR><BR>Thanks for ur reply .. u r right i am newbie in
Hibernate and Spring !! <BR><BR>I thought that creating table schema
automatically is a GOOD feature of Hibernate ..<BR><BR>For example:-<BR><BR>If
your application is using some tables .. u create those tables in your db ..
<BR>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... <BR>But
If you u r using hibernate ...there is no need for this ..because it
automatically creates the table schemas .. <BR><BR>Please correct do me ..if my
argument is wrong ..<BR><BR>With Hibernate-PostGIS .. it is not able to create
the Geometry column automatically .. i thought it was <SPAN
style="FONT-WEIGHT: bold">BUG </SPAN>which needed attention .. so i posted it
... <BR><BR>I have no other problem with using Hibernate with postgis
....<BR><BR>I really appreciate ur other suggestions as
well..<BR><BR>Thanks <BR>Regards<BR>Sandeep<BR><BR><BR><BR>
<DIV><SPAN class=gmail_quote>On 11/22/06, <B class=gmail_sendername>Jan
Syryn</B> <<A href="mailto:jan.syryn@trasys.be">jan.syryn@trasys.be</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Hi
Sandeep,</FONT></SPAN><BR></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><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></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><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><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><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><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><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><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><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>Little
suggestion: </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>- make the
geometry column nullable. </FONT></SPAN><SPAN><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><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><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><FONT face=Arial><FONT color=#0000ff size=2>for
exemple: </FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial><FONT color=#0000ff
size=2> session.save(new
RoadNetwork("sandeep"))</FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><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><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><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> Geometry myGeom =
factory.createGeometry();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2> session.save(new
RoadNetwork("sandeep",myGeom))</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff size=2>HIH (I
hope it helps), </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2>Jan</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN><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 lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> <A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A> [mailto:<A
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A>] <B>On Behalf
Of </B>Sandeep Kumar Jakkaraju<BR><B>Sent:</B> samedi 18 novembre 2006
15:54<SPAN class=q><BR><B>To:</B> PostGIS Users Discussion<BR><B>Subject:</B>
Re: [postgis-users] Hibernate with PostGIS<BR></SPAN></FONT><BR></DIV>
<DIV><SPAN class=e id=q_10f1014ffaeccbd4_3>
<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></SPAN></DIV></DIV><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net
</A><BR><A onclick="return top.js.OpenExtLink(window,event,this)"
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR><BR></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Sandeep Kumar Jakkaraju <BR>WeBlog:<BR><A
href="http://jakkarajus.blogspot.com">http://jakkarajus.blogspot.com</A>
</BODY></HTML>