Can Hibernate Spatial work with JPA and Java EE container EJB transaction handling?

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

Can Hibernate Spatial work with JPA and Java EE container EJB transaction handling?

bjornharrtell
I'm having issues getting Hibernate Spatial 4.0-M1 to work with container managed transcations. I'm using JBoss AS 7.

I have added postgresql and postgis as a module to be able to define my datasource in JBoss and let it manage transactions.

Hibernate Spatial is included in the war WEB-INF/lib.

I'm hitting this exception:

java.lang.IllegalArgumentException: Can't convert object of type org.postgis.PGgeometry
        org.hibernate.spatial.dialect.postgis.PGGeometryValueExtractor.toJTS(PGGeometryValueExtractor.java:99)

The problem seem to be that Hibernate Spatial does not have access to the postgis classes. I cannot add the postgis jdbc jar to WEB-INF/lib as it will conflict with the JBoss module.

Anyone been able to use Hibernate Spatial in this scenario?
Reply | Threaded
Open this post in threaded view
|

Re: Can Hibernate Spatial work with JPA and Java EE container EJB transaction handling?

bjornharrtell
Finally, after two days work, found the solution which essentially was to include Hibernate Spatial in the JBoss hibernate module instead of in the applications WEB-INF/lib.

Wrote down a how to for future reference:
https://gist.github.com/3054462