I also tried - you can get the data if you declare your field in JPA as Byte[] , and it will look like blob, but in the MySQL spatial internal format - so no matter what, you will always get an unreadable internal format - the best way in JPA, use your own SQL query to output data as text.
SELECT AsText(columnName) FROM tableName;
For instace:
String sql = "SELECT AsText(LOCATION) FROM ENTITY where id=?1"; return (String) em.createNativeQuery(sql) .setParameter(1, id) .getSingleResult();
returns in my case: POINT(40.01999 -75.147171) .
bsautner
source share