I am trying to access Postgis functions in Restful web service JAVA.
I am using netbeans 8.0.2, Glass Fish, J2EE 7 to create web service, PostGres 9.2 and postgis 2.1.1. Connection to postgres is established successfully and I am able to read postgis table data successfully in JSON and XML format.
But my problem is that when I try to call postgis function on geometry column, I am getting this error:
I also added postgis.jar file in classpath, but I am still getting the same error.
Solution that I tried: Link
Here is my code:
@GET @Path("getgeom") @Produces("text/plain") public String getgeom() { EntityManager em = getEntityManager(); List query = em.createQuery( "SELECT ST_AsText(c.geom) FROM Userinfo c") .getResultList(); return query.toString(); } When I execute the same query in PSQL console, it is working fine.
What I am missing? How can I use Postgres Native queries with postgis functions in my java web service?
أكثر...
I am using netbeans 8.0.2, Glass Fish, J2EE 7 to create web service, PostGres 9.2 and postgis 2.1.1. Connection to postgres is established successfully and I am able to read postgis table data successfully in JSON and XML format.
But my problem is that when I try to call postgis function on geometry column, I am getting this error:

I also added postgis.jar file in classpath, but I am still getting the same error.
Solution that I tried: Link
Here is my code:
@GET @Path("getgeom") @Produces("text/plain") public String getgeom() { EntityManager em = getEntityManager(); List query = em.createQuery( "SELECT ST_AsText(c.geom) FROM Userinfo c") .getResultList(); return query.toString(); } When I execute the same query in PSQL console, it is working fine.
What I am missing? How can I use Postgres Native queries with postgis functions in my java web service?
أكثر...