[postgis-users] SpatialEJB3: (PostGIS and Hibernate)

Norman Barker nbarker at ittvis.com
Thu Dec 21 04:38:10 PST 2006


Hi Andrew,

 

I have taken your code, created a new database called Test based on the
postgis template, and changed the datasource in test-ds, persistence.xml
in src/META-INF now references this.  I have also created a simple
remote client.

 

Copy postgis.jar and postgresqlXx.jar to the lib directory of this
distribution, and set up JBoss/server/default/lib with postgis.jar and
postgresqlXxx.jar as well.

 

Running ant deploy, will deploy the app to JBoss, running ant runClient
will run the test client in src/Client.java

 

I slightly changed your query logic for getSingleResult, because the
logic in your schema means you can have multiple locations per name.  It
works nicely for me!!

 

When you created your database did you base it on the postgis template,
if not load 

C:\program files\postgresql-8.1\share\contrib spatial-ref-sys.sql and
lwpostgis.sql

 

It sounds as if your database doesn't have the geometry type,
particularly as you can load the null type in the table.

 

Let me know if you have any other problems.

 

Norman

 

________________________________

From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Andrew Hughes
Sent: 20 December 2006 23:47
To: PostGIS Users Discussion
Subject: Re: [postgis-users] SpatialEJB3: (PostGIS and Hibernate)

 

Hi Norman,

thanks for the reply again! I've tried adding everything like you have
suggested... the org.postgis.GeomteryType needed appears to be needed in
the beans.jar inside the ear... However I have also packed this in its
own jar (hibernate-geomtype.jar) which I have placed in both the
$JBOSS$/client and $JBOSS$/server/default/lib directories. FYI: the
database schema is most definately not the problem.

I have tried everything I know to get this working, without success... I
can persist null geometry objects, and using native queries I seem to
persist the Geometry as garbage in the database... strange (Even tho I
am sending geomAsText(....) in my native insert statement).. 

It seems pretty obvious that my persistance container does not
understand what a Geomtery or GeometryType are.Below is a copy of the
stacktrace I get when I try and persist() a record containing a valid
POINT.  

Attatched are my beans (which might make more scence that me!). 


Thanks in advance, and for the help you've already offered.


Stacktrace from a manager.persist():

________________________________



09:52:24,200 INFO  [STDOUT] Hibernate: insert into Location (name, geom,
id) values (?, ?, ?)
09:52:24,270 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
09:52:24,270 ERROR [JDBCExceptionReporter] Batch entry 0 insert into
Location (name, geom, id) values ( was aborted. Call getNextException()
to see th
e cause.
09:52:24,270 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: XX000
09:52:24,270 ERROR [JDBCExceptionReporter] ERROR: parse error - invalid
geometry

09:52:24,270 ERROR [AbstractFlushingEventListener] Could not synchronize
database state with session
org.hibernate.exception.GenericJDBCException: Could not execute JDBC
batch update
        at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQ
LStateConverter.java:103)
        at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java
:91)
        at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.
java:43)
        at
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249
)
        at
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
        at
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
        at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(
AbstractFlushingEventListener.java:298)
        at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEv
entListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
        at
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerI
mpl.java:296)
        at
org.jboss.ejb3.entity.TransactionScopedEntityManager.flush(TransactionSc
opedEntityManager.java:204)
        at
com.lisasoft.routedirections.ard.beans.RouteDirectionsARDBean.setLocatio
n(RouteDirectionsARDBean.java:65)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:112)
        at
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationConte
xtImpl.java:166)
        at
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3Interc
eptorsInterceptor.java:63)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(T
ransactionScopedEntityManagerInterceptor.java:54)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInte
rceptor.java:47)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
        at
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:19
7)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterc
eptor.java:76)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessIn
stanceInterceptor.java:62)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authenticati
onInterceptor.java:77)
        at
org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Authent
icationInterceptor.java:131)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationIntercepto
r.java:47)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousI
nterceptor.java:106)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessConta
iner.java:263)
        at
org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.jav
a:58)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProx
y.java:102)
        at $Proxy89.setLocation(Unknown Source)
        at
com.lisasoft.routedirections.ard.delegates.LocationDelegate.setLocation(
LocationDelegate.java:23)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:92)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:334)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
        at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilte
r.java:96)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:202)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178)
        at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAs
sociationValve.java:175)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:432)
        at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.j
ava:74)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)
        at
org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn.invoke(ClusteredSingl
eSignOn.java:637)
        at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnecti
onValve.java:156)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:664)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)
        at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorker
Thread.java:112)
        at java.lang.Thread.run(Thread.java:595)
Caused by: Batch entry 0 insert into Location (name, geom, id) values (
was aborted. Call getNextException() to see the cause.
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2St
atement.java:107)
        at
org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedSta
tement.java:519)
        at
org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:4
8)
        at
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242
)
        ... 68 more
09:52:24,300 ERROR [RouteDirectionsARDBean] Problem with Hibernate SQL:
javax.persistence.PersistenceException:
org.hibernate.exception.GenericJDBCException: Could not execute JDBC
batch update
        at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(Ab
stractEntityManagerImpl.java:641)
        at
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerI
mpl.java:299)
        at
org.jboss.ejb3.entity.TransactionScopedEntityManager.flush(TransactionSc
opedEntityManager.java:204)
        at
com.lisasoft.routedirections.ard.beans.RouteDirectionsARDBean.setLocatio
n(RouteDirectionsARDBean.java:65)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:112)
        at
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationConte
xtImpl.java:166)
        at
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3Interc
eptorsInterceptor.java:63)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(T
ransactionScopedEntityManagerInterceptor.java:54)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInte
rceptor.java:47)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
        at
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:19
7)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterc
eptor.java:76)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessIn
stanceInterceptor.java:62)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.aspects.security.AuthenticationInterceptor.invoke(Authenticati
onInterceptor.java:77)
        at
org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3Authent
icationInterceptor.java:131)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationIntercepto
r.java:47)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousI
nterceptor.java:106)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessConta
iner.java:263)
        at
org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.jav
a:58)
        at
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.jav
a:101)
        at
org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProx
y.java:102)
        at $Proxy89.setLocation(Unknown Source)
        at
com.lisasoft.routedirections.ard.delegates.LocationDelegate.setLocation(
LocationDelegate.java:23)
        at org.apache.jsp.index_jsp._jspService(index_jsp.java:92)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:334)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
        at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilte
r.java:96)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:202)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178)
        at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAs
sociationValve.java:175)
        at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator
Base.java:432)
        at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.j
ava:74)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)
        at
org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn.invoke(ClusteredSingl
eSignOn.java:637)
        at
org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnecti
onValve.java:156)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.proc
essConnection(Http11BaseProtocol.java:664)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)
        at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorker
Thread.java:112)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.exception.GenericJDBCException: Could not
execute JDBC batch update
        at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQ
LStateConverter.java:103)
        at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java
:91)
        at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.
java:43)
        at
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:249
)
        at
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
        at
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:139)
        at
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(
AbstractFlushingEventListener.java:298)
        at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEv
entListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
        at
org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerI
mpl.java:296)
        ... 62 more
Caused by: Batch entry 0 insert into Location (name, geom, id) values (
was aborted. Call getNextException() to see the cause.
        at
org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2St
atement.java:107)
        at
org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedSta
tement.java:519)
        at
org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:4
8)
        at
org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242
)
        ... 68 more






Norman Barker wrote: 

Hi Andrew,
 
What you are saying is correct, but I will expand on it just to be clear
for you and others.
 
You have to add the GeometryType to your project, and postgis.jar, and
postgresqlXx.jar to the JBoss path (JBOSS_HOME\server\default\lib for
example).
 
It is then sufficient to mark a geometry getter of a POJO (with the
@Entity annotation at the class level) as     
 
@Type(type = "org.postgis.hibernate.GeometryType")
@Column(name="bbox", columnDefinition="Geometry")   (name can be
whatever you want, or you can leave it to hibernate to choose it for you
:-) )
 
Then in your stateless session bean you can inject the entityManager 
 
        @PersistenceContext(unitName="MyConfiguration")
        private EntityManager entityManager;
 
and persist your entity pojos as per normal.
 
If you configure your persistence.xml as follows then the PostGIS tables
of your spatial database are created for you (can be a good or a bad
thing depending on your view point, you have to add the spatial index by
hand).
 
<persistence>
        <persistence-unit name="MyConfiguration">
               <jta-data-source>java:/MY_DS</jta-data-source>
               <properties>
                       <property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
                       <property name="hibernate.hbm2ddl.auto"
value="update"/>
                       <!-- property name="hibernate.show_sql"
value="true"/>  -->
               </properties>
        </persistence-unit>
</persistence>
 
Hope this gets you started, please post your findings back to the list.
 
Thanks,
 
Norman
 
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Andrew Hughes
Sent: 19 December 2006 02:05
To: PostGIS Users Discussion
Subject: Re: [postgis-users] SpatialEJB3: (PostGIS and Hibernate)
 
Hi Norman,
 
Thanks very much for the reply. Originally I noticed that this was an 
eclipse project, so I tried to get it to compile in Eclipse.... however 
this failed (and I made the wrong assumption that I needed the JBoss IDE
 
plugins installed).
 
Anyway, I have tried this with Ant directly and I now have this 
compiling.. and building the injest.jar.
 
I don't want to use the message driven beans as in the tutorial... or 
SOAP,  I am using stateless session beans, currently with PostgreSQL... 
but I obviously want to add the Geometry Type to the hibernate actions.
 
I am correct in assuming that I simply need to add the GeometryType.java
 
class to my project to enable this? I would then use annotations to 
specify the GeometryType such as:
 
@Type(type = "org.postgis.hibernate.GeometryType")
 
Is there anything that I am missing?
 
Thanks in advance
 
--AH
 
 
 
Norman Barker wrote:
  

	Hi Andrew,
	 
	Hopefully this gets to you before you start downloading the
JBoss IDE!
	 
	The project uses Ant, and the Java 1.5 JDK.
	 
	(http://ant.apache.org)
	(http://svn.refractions.net/postgis/trunk/java/ejb3/build.xml)
	 
	If you edit the paths in build.xml to point to your
installation,
	running 'ant deploy' will build and deploy everything to JBoss
for
	    

you.
  

	I used to use the JBoss IDE in the XDoclet for EJB2.x days, but
with
	annotations I have dumped it for plain eclipse - but perhaps I
should
	give it a go.
	 
	Norman
	 
	  
	 
	-----Original Message-----
	From: postgis-users-bounces at postgis.refractions.net
	[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf
Of
	Andrew Hughes
	Sent: 18 December 2006 05:48
	To: PostGIS Users Discussion
	Subject: Re: [postgis-users] SpatialEJB3: (PostGIS and
Hibernate)
	 
	Thanks for the reply....
	 
	I have checked out the EJB3Spatial source from SVN: 
	http://svn.refractions.net/postgis/trunk/java/ejb3/
	 
	Now, I am presuming that this requires the JBoss IDE? since it
doesn't
	    

 
  

	build with Eclipse.... and I can't see this anywhere in the
tutorial.
	 
	The JBoss plugins are in total 119Mb.... which is rather painful
and 
	slow... it would be rather helpful if the binaries where
available for
	    

 
  

	direct download.
	 
	 
	When I finally get this downloaded I'll hopefully make some good
	progress :)
	 
	 
	 
	 
	Norman Barker wrote:
	  
	    

		Hi,
		 
		Glad you like the idea! PostGIS does all the work though
J, and there
		      

 
  

		have been some good bug reports and questions from users
as well.
		 
		In conclusion;
		 
		There have been quite a few users of the EJB3 Geometry
annotations, 
		but they are split between JBoss users, and pure
Hibernate/Spring 
		users - it works well in either environment. Since it is
possible to 
		mark a property of an entity as @Geometry and then have
it persist
		      

and
  

		    
		      

	  
	    

		retrieve from PostGIS then the investigation was a
success, and I am 
		using it in more projects (and once my current deadlines
are out of 
		the way, I want to do some more to the codebase).
		 
		The incorporation of spatial functions into hql and
ejb-ql is I 
		believe the next step, but quite a major undertaking.
Certainly at
		      

the
  

		    
		      

	  
	    

		moment you could achieve the same functionality with 
		entitymanager.createNativeQuery for example (which I use
to run
		      

vacuum
  

		    
		      

	  
	    

		analyze).
		 
		Let me know if you have any questions, and do post more
details about
		      

 
  

		your project, there have been some interesting use
cases.
		 
		Thanks,
		 
		Norman
		 
		 
		    
		      

------------------------------------------------------------------------
  

	  
	    

		*From:* postgis-users-bounces at postgis.refractions.net 
		[mailto:postgis-users-bounces at postgis.refractions.net]
*On Behalf Of 
		*Andrew Hughes
		*Sent:* 12 December 2006 04:39
		*To:* PostGIS Users Discussion
		*Subject:* [postgis-users] SpatialEJB3: (PostGIS and
Hibernate)
		 
		Hello All,
		 
		I would like to use the SpatialEJB3 JBoss container for
my JBoss Web 
		Service.
		 
		The SpatialEJB3 [ 
		
http://postgis.refractions.net/support/wiki/index.php?SpatialEJB3 ] 
		seems to be exactly what I want, but I do have some
concerns before I
		      

 
  

		invest some time in this.....
		 
		    * Was there a conclusion to the SpatialEJB3
Investigation:
		      "/Spatial EJB3 is a quick investigation to see if
it is
		      

possible
  

		      to integrate the Java 5 annotation approach to
mark a property
		      of an object as spatial and to delegate to the
EJB3 persistence
		      model to store and retrieve this data./"?
		    * I require the PostGIS functions [such as
		      /intersects(geometry,geometry)/] to extract the
data I am
		      looking for in my spatial database. I am unable to
find a
		      reference to any java code that shows someone
running anything
		      [like /select intersection(my_geom,geometry) from
		      locations_table where
intersects(my_geom,geomtery);/ ] ?
		 
		 
		For the people who are involved in the Spatial EJB3, I
really like
		      

the
  

		    
		      

	  
	    

		idea... well-done!!!
		 
		 
		--AH
		 
		 
		    
		      

------------------------------------------------------------------------
  

	  
	    

		_______________________________________________
		postgis-users mailing list
		postgis-users at postgis.refractions.net
		
http://postgis.refractions.net/mailman/listinfo/postgis-users
		  
		    
		      

	 
	  
	    

 
 
  

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061221/d8bc7fbc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: route.zip
Type: application/x-zip-compressed
Size: 13704 bytes
Desc: route.zip
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20061221/d8bc7fbc/attachment.bin>


More information about the postgis-users mailing list