[postgis-users] Hibernate with PostGIS

Sandeep Kumar Jakkaraju sandeepkumar.jakkaraju at gmail.com
Sat Nov 18 05:27:28 PST 2006


Hi Norman


Please Help ..

This my class definition ...

public class RoadNetwork {

private Geometry location=null;
private long id;

public long getId()
{
return id;
}

public void setId(long id)
{
this.id = id;
}

public void setLocation(Geometry loc)
{
this.location = loc;
}

public Geometry getLocation()
{
return location;
}

}

My RoadNetwork.hbm.xml....


<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
    <class
        name="hello.RoadNetwork"
        table="Roads"
    >

        <id
            name="id"
            column="id"
            type="java.lang.Long"
        >

            <generator class="increment">

  </generator>
        </id>
        <property
            name="location"
            type="org.postgis.hibernate.GeometryType"
            update="true"
            insert="true"
            column="location"
         />
  </class>
</hibernate-mapping>








On 11/17/06, Norman Barker <nbarker at ittvis.com> wrote:
>
> Hi Sandeep,
>
> the hibernate driver is at
> http://svn.refractions.net/postgis/trunk/java/ejb3/src/org/postgis/hibernate/GeometryType.java
> and as I understand it this is sufficient for hibernate to persist
> Geometry types, or use in JBoss EJB3.  This hibernate driver in turn uses
> postgis.jar, which in turn uses the postgresql driver.
>
> There has been a lot said about EJB3 versus Spring with Hibernate (and I
> have taken your bait!!).   I guess it is down to the level (scalable) of the
> system you want to build and whether you want to follow enterprise standards
> (EJB3 is the standard that builds on top of the lessons learnt in Hibernate
> and Spring IoC).  I would use either since JPA is also a standard, but I
> will be looking to port to Geronimo as soon as they get EJB3 to give
> container options; my reasons for EJB3 were
>
> (1) Scalability via clustering - this is very important for catalogs for
> disaster / crisis management
> (2) Declarative security
> (3) Transaction Management (potential WFS)
> (4) Stateful sessions (for other parts of my app)
>
> Suddenly I was using more of a J2EE container than a lightweight
> framework.  I would say JBoss is light as well though!
>
> The most important thing here is the Hibernate POJO Geometry Driver for
> PostGIS, the framework doesn't matter too much. If you want the PostGIS,
> Hibernate (JBoss EJB3) stack to go into a different direction (Spring) give
> me a compelling reason - or lets work together to make this stack
> 'enterprise ready' for the community!
>
> Let me know if you need any help.
>
> Norman
>
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net on behalf of Sandeep
> Kumar Jakkaraju
> Sent: Thu 11/16/2006 5:58 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Hibernate with PostGIS
>
> Hi Norman
>
> For using Hibernate with postgis ..i can directly use ur postgis.jar !!
> right ...??
>
> Your Tutorial mainly aimed at using EJB3 with postgis ...
> did u think of using Spring instead of EJB3 !! ??
>
> Thanks
> Sandeep
>
>
>
> On 11/16/06, Norman Barker <nbarker at ittvis.com> wrote:
> >
> >  Sandeep,
> >
> >
> >
> > To use JBoss EJB3 with PostGIS I had to write a Hibernate Geometry
> Driver,
> > the source code is in PostGIS SVN (LGPL) and there is a tutorial
> available
> > here
> >
> > -
> > http://postgis.refractions.net/support/wiki/index.php?SpatialEJB3
> >
> >
> >
> > It allows creation and updates through Java, the tutorial walks you
> > through a simple SOAP example.
> >
> >
> >
> > I am very interested in using the hibernate lucene annotations (
> >
> http://www.hibernate.org/hib_docs/annotations/reference/en/html/lucene.html
> )
> > in conjunction with the Geometry driver to create some sort of catalog;
> so
> > that we can do a proper geometry search on PostGIS through the business
> > layer (not just boxes!) and then seach on metadata with Lucene.
> >
> >
> >
> > A couple of people have expressed interest in this hibernate geometry
> > driver for Java, please give me some feedback on the future direction
> you
> > want this to go.
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Norman
> >
> >
> >  ------------------------------
> >
> > *From:* postgis-users-bounces at postgis.refractions.net [mailto:
> > postgis-users-bounces at postgis.refractions.net] *On Behalf Of *Sandeep
> > Kumar Jakkaraju
> > *Sent:* 16 November 2006 15:30
> > *To:* PostGIS Users Discussion
> > *Subject:* [postgis-users] Hibernate with PostGIS
> >
> >
> >
> > Hi All
> >
> > I want to know if i can use Hibernate with PostGIS ??
> > if yes ..then can some one point me to some doc which tells abt this !!
> >
> > I am just skeptical about the geometry column !!
> >
> > Thanks
> > Sandeep
> >
> > _______________________________________________
> > postgis-users mailing list
> > postgis-users at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-users
> >
> >
> >
>
>
> --
> Sandeep Kumar Jakkaraju
> WeBlog:
> http://jakkarajus.blogspot.com
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>


-- 
Sandeep Kumar Jakkaraju
WeBlog:
http://jakkarajus.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061118/53a634a6/attachment.html>


More information about the postgis-users mailing list