0

I'm working on a java application and I'm saving via hibernate an object which hierarchically contains another object with a PGpoint field.

I'm trying ways to make hibernate save the PGpoint in a postgres+postgis spatial representation, but nothing works.

I've tried leaving without specific annotations but i've got errors (I think building the correct query). I've tried writing a custom AttributeConverter but I failed doing so, I don't even know what type of Point should I use, or how to properly do that. I've tried using the geolatte postgisconverter, but i've got errors also.

What should I do?

ro.nin
  • 121
  • 5
  • 13
  • Have you already looked into Hibernate Spatial? – Rlarroque May 19 '17 at 15:38
  • Yes, for testing purpose I changed my PGpoint to a jts.geom.point Then I used: @Type(type="jts_geometry"). Nothing. – ro.nin May 19 '17 at 16:14
  • yes, you can create your own custom type.. here you can see my answer https://stackoverflow.com/questions/53548731/how-to-work-with-pgpoint-for-geolocation-using-postgresql/53754866#53754866 – Jonathan JOhx Dec 13 '18 at 04:10

1 Answers1

0

Couldn't manage to save a PGPoint but managed to save a Point, I was also doing a silly error naming a field "from" which was causing problem to postgres and mislead many shots I tried at solving the problem.

ro.nin
  • 121
  • 5
  • 13
  • yes, but you can create your own custom type.. here you can see my answer https://stackoverflow.com/questions/53548731/how-to-work-with-pgpoint-for-geolocation-using-postgresql/53754866#53754866 – Jonathan JOhx Dec 13 '18 at 04:08