Hibernate annotations and HibernateSpatial

2 messages Options
Embed this post
Permalink
Jean-Adrien

Hibernate annotations and HibernateSpatial

Reply Threaded More More options
Print post
Permalink
Hello,

I just discovered hibernate spatial, and I tried to use it with postgres / postgis / jts
It works fine with xml mapping, but I actually prefer to use hibernate annotation rather than xml mapping in order to define my mappings.

As I browse the project I believed the hibernatespatial-annotations are not implemented. But I saw in a post that there are code sample that uses the annotation. Unfortunately I haven't found it and moreover it seems that another part of project is needed to enable this. Anyway.

This is the post:
http://www.nabble.com/Re%3A-way-to-specify-class%27s-hibernate%09mapping-at-runtime--td15866541.html#a15870059

I was wondering if somebody knows another part of code to enable this, or if poeple tried to work with a mixed solution with annotations and xml.

Regards

Jean-Adrien

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Karel Maesen

Re: Hibernate annotations and HibernateSpatial

Reply Threaded More More options
Print post
Permalink
Hello Jean-Adrien,

Please register to this forum before posting. Otherwise your mails  
risk being ignored.

On 29 Apr 2008, at 16:49, [hidden email] wrote:
>
>
> I just discovered hibernate spatial, and I tried to use it with  
> postgres / postgis / jts
> It works fine with xml mapping, but I actually prefer to use  
> hibernate annotation rather than xml mapping in order to define my  
> mappings.
>

Using the annotations should work just fine out of the box. Nothing  
special needs to be done.

The getter should be annotated like this:
        @Column(name="the_geom")
         @Type(type="org.hibernatespatial.GeometryUserType")
         public Geometry getGeometry(){
                 return this.geometry;
         }


> As I browse the project I believed the hibernatespatial-annotations  
> are not implemented. But I saw in a post that there are code sample  
> that uses the annotation. Unfortunately I haven't found it and  
> moreover it seems that another part of project is needed to enable  
> this. Anyway.
>
> This is the post:
> http://www.nabble.com/Re%3A-way-to-specify-class%27s-hibernate% 
> 09mapping-at-runtime--td15866541.html#a15870059

The post you are referring to discusses generating the Hibernate  
mapping automatically from the database metadata. That obviously  
requires some special code that is now being developed.

Regards,

Karel Maesen

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users