Hibernate Spatial in Eclipse?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Hibernate Spatial in Eclipse?

JPHespanha-3
Hi,
 
I am new to this list, and also to Hibernate... :-)
I plan to use the Hibernate Spatial extension to Hibernate in my research and I wonder if someone here is using it in the Eclipse platform.
If it is so, I want to know how to configure the classpath and also the Ant build file in order to run Hibernate Spatial tutorial example. Currently, I have Hibernate Tools, Antlr, postgis and postgressql, plus the log4E jars in the Build path (for the Hibernate tutorial).
 
Regards,
J.P. Hespanha 

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate Spatial in Eclipse?

Karel Maesen
Administrator
Hi,

I'm using Eclipse together with maven for the development of  
Hibernate Spatial. I selected maven because of its dependency  
management features.

Maven uses a pom.xml that describes your whole project. If you  
specify the hibernate-spatial and the JTS repositories in your  
pom.xml, and add hibernate-spatial-postgis as  a dependency, you can  
just do :

$ mvn eclipse:clean
$ mvn eclipse:eclipse

and this will have maven create all necessary  Eclipse metadata for  
your project, and download everything you need. (Check the  
documentation on the maven Eclipse plugin here: http://
maven.apache.org/plugins/maven-eclipse-plugin/)

The relevant POM elements look like this:

<dependency>
   <groupId>org.hibernatespatial</groupId>
   <artifactId>hibernate-spatial-postgis</artifactId>
   <version>1.0-SNAPSHOT</version>           </dependency>

<repository>
   <id>hibernatespatial</id>
   <name>Hibernatespatial repository</name>
   <layout>default</layout>
   <url>http://www.hibernatespatial.org/repository</url>
   <releases>
       <enabled>true</enabled>
   </releases>
   <snapshots>
       <enabled>true</enabled>
   </snapshots>
</repository>
       <repository>
   <id>refractions.net</id>
   <name>Postgis repository</name>
   <layout>default</layout>
   <url>http://lists.refractions.net/m2/</url>
   <releases>
       <enabled>true</enabled>
   </releases>
   <snapshots>
       <enabled>true</enabled>
   </snapshots>
</repository>


If you want to go this route, be sure to read up on maven. It is a  
great tool, but it can be frustrating to learn and come to grips with.

If you stick to ant, you could look here for all dependencies that  
you normally need: http://www.hibernatespatial.org/hibernate-spatial- 
postgis/dependencies.html

Regards,

Karel Maesen


On 20 Nov 2007, at 17:30, Fonseca Hespanha de Oliveira, Joao da wrote:

> Hi,
>
> I am new to this list, and also to Hibernate... :-)
> I plan to use the Hibernate Spatial extension to Hibernate in my  
> research and I wonder if someone here is using it in the Eclipse  
> platform.
> If it is so, I want to know how to configure the classpath and also  
> the Ant build file in order to run Hibernate Spatial tutorial  
> example. Currently, I have Hibernate Tools, Antlr, postgis and  
> postgressql, plus the log4E jars in the Build path (for the  
> Hibernate tutorial).
>
> Regards,
> J.P. Hespanha
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate Spatial in Eclipse?

JPHespanha-3
Karel:

Thank you for the tips regarding maven. It certainly looks interesting
in the way it works (freeing much of the configuration work), but for
the moment I am giving a try to Ant, so I am following the instructions
on the  
http://www.hibernatespatial.org/hibernate-spatial-postgis/dependencies.h
tml page.
All this software environment is new to me, that just used VBA under MS
Office (plus some ArcObjects from ESRI).

While I was configuring the project Build Path in Eclipse, however, I
noticed that the files from Hibernate Spatial for PostGIS presented some
problems:
1. The file 'hibernate-spatial-postgis-1.0-20070430.162253-3.jar' is
refered on the internet page as
'hibernate-spatial-1.0-20070430.162253-3.jar'. Is this OK?

2. This same file has just 384 bytes and does not open with the power
archiver (seems corrupted).

I guess the right combination for a Hibernate Spatial configuration is
then:
Core: 'hibernate-spatial-1.0-20070920.111959-1.jar'
PostGIS: 'hibernate-spatial-postgis-1.0-20070920.111959-1.jar'

Regards,
Joao
-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On
Behalf Of Karel Maesen
Sent: Tuesday, November 20, 2007 10:12 PM
To: Hibernate Spatial Users Discussion
Subject: Re: [hibernatespatial-users] Hibernate Spatial in Eclipse?

Hi,

I'm using Eclipse together with maven for the development of Hibernate
Spatial. I selected maven because of its dependency management features.

Maven uses a pom.xml that describes your whole project. If you specify
the hibernate-spatial and the JTS repositories in your pom.xml, and add
hibernate-spatial-postgis as  a dependency, you can just do :

$ mvn eclipse:clean
$ mvn eclipse:eclipse

and this will have maven create all necessary  Eclipse metadata for your
project, and download everything you need. (Check the documentation on
the maven Eclipse plugin here: http://
maven.apache.org/plugins/maven-eclipse-plugin/)

The relevant POM elements look like this:

<dependency>
   <groupId>org.hibernatespatial</groupId>
   <artifactId>hibernate-spatial-postgis</artifactId>
   <version>1.0-SNAPSHOT</version>           </dependency>

<repository>
   <id>hibernatespatial</id>
   <name>Hibernatespatial repository</name>
   <layout>default</layout>
   <url>http://www.hibernatespatial.org/repository</url>
   <releases>
       <enabled>true</enabled>
   </releases>
   <snapshots>
       <enabled>true</enabled>
   </snapshots>
</repository>
       <repository>
   <id>refractions.net</id>
   <name>Postgis repository</name>
   <layout>default</layout>
   <url>http://lists.refractions.net/m2/</url>
   <releases>
       <enabled>true</enabled>
   </releases>
   <snapshots>
       <enabled>true</enabled>
   </snapshots>
</repository>


If you want to go this route, be sure to read up on maven. It is a great
tool, but it can be frustrating to learn and come to grips with.

If you stick to ant, you could look here for all dependencies that you
normally need: http://www.hibernatespatial.org/hibernate-spatial-
postgis/dependencies.html

Regards,

Karel Maesen


On 20 Nov 2007, at 17:30, Fonseca Hespanha de Oliveira, Joao da wrote:

> Hi,
>
> I am new to this list, and also to Hibernate... :-) I plan to use the
> Hibernate Spatial extension to Hibernate in my research and I wonder
> if someone here is using it in the Eclipse platform.
> If it is so, I want to know how to configure the classpath and also
> the Ant build file in order to run Hibernate Spatial tutorial example.

> Currently, I have Hibernate Tools, Antlr, postgis and postgressql,
> plus the log4E jars in the Build path (for the Hibernate tutorial).
>
> Regards,
> J.P. Hespanha
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatia
l-users
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate Spatial in Eclipse?

Karel Maesen
Administrator
Hi,


On 23 Nov 2007, at 13:31, Fonseca Hespanha de Oliveira, Joao da wrote:

>
> While I was configuring the project Build Path in Eclipse, however, I
> noticed that the files from Hibernate Spatial for PostGIS presented  
> some
> problems:
> 1. The file 'hibernate-spatial-postgis-1.0-20070430.162253-3.jar' is
> refered on the internet page as
> 'hibernate-spatial-1.0-20070430.162253-3.jar'. Is this OK?
>
> 2. This same file has just 384 bytes and does not open with the power
> archiver (seems corrupted).
>

Thanks for pointing that out. I'll correct the link.

> I guess the right combination for a Hibernate Spatial configuration is
> then:
> Core: 'hibernate-spatial-1.0-20070920.111959-1.jar'
> PostGIS: 'hibernate-spatial-postgis-1.0-20070920.111959-1.jar'
>

You really should go with the latest releases, since these are much  
improved.

Btw, in the next week or two I'll release new versions of the libraries.

Regards,

Karel
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Hibernate Spatial in Eclipse?

JPHespanha-3
Finaly!

Well, I managed to run the Hibernate Spatial Tutorial using Eclipse,
although I firmly believe it was not in a very 'elegant' way, specially
for the Ant file, which was severely hacked.

This last few lines of the console show the regular output (I hope...):

     [java] Hibernate: insert into EVENTS (EVENT_DATE, title, LOC,
EVENT_ID) values (?, ?, ?, ?)
     [java] 18:21:19,073 DEBUG TimestampType:80 - binding '2007-11-23
18:21:16' to parameter: 1
     [java] 18:21:19,073 DEBUG StringType:80 - binding 'My Event' to
parameter: 2
     [java] 18:21:19,104 DEBUG LongType:80 - binding '1' to parameter: 4
     [java] 18:21:19,870  INFO SessionFactoryImpl:767 - closing
     [java] 18:21:19,870  INFO DriverManagerConnectionProvider:147 -
cleaning up connection pool: jdbc:postgresql://localhost:5432/events
BUILD SUCCESSFUL
Total time: 6 seconds

I just noticed that nowhere in both Tutorials (basic Hibernate and
Hibernate Spatial) it is mentioned that a database with the name
"events" should be created. For the PostGIS case, of course it should
use the template_postgis as seed. Also, one must connect to the
postgresql server in advance (the service must be running). All this
seems obvious for a regular programmer or DBA, not so much for a
newbie...

I will continue with the tutorial (queries) before moving to my own
databases.

Note: in the lines above, I see that DEBUG is binding all alphanumeric
attributes, but the spatial attribute LOC does not report any binding.
Anyway, I confirmed that it has indeed a value in the table.

Regards,
JP Hespanha

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On
Behalf Of Karel Maesen
Sent: Friday, November 23, 2007 1:43 PM
To: Hibernate Spatial Users Discussion
Subject: Re: [hibernatespatial-users] Hibernate Spatial in Eclipse?

Hi,


On 23 Nov 2007, at 13:31, Fonseca Hespanha de Oliveira, Joao da wrote:

>
> While I was configuring the project Build Path in Eclipse, however, I
> noticed that the files from Hibernate Spatial for PostGIS presented
> some
> problems:
> 1. The file 'hibernate-spatial-postgis-1.0-20070430.162253-3.jar' is
> refered on the internet page as
> 'hibernate-spatial-1.0-20070430.162253-3.jar'. Is this OK?
>
> 2. This same file has just 384 bytes and does not open with the power
> archiver (seems corrupted).
>

Thanks for pointing that out. I'll correct the link.

> I guess the right combination for a Hibernate Spatial configuration is
> then:
> Core: 'hibernate-spatial-1.0-20070920.111959-1.jar'
> PostGIS: 'hibernate-spatial-postgis-1.0-20070920.111959-1.jar'
>

You really should go with the latest releases, since these are much
improved.

Btw, in the next week or two I'll release new versions of the libraries.

Regards,

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