1

On my DB, the data looks like this:

enter image description here

In the DAO I am executing a query:

public Object login(UserEntity user) {
        StringBuffer sb = new StringBuffer();
        sb.append("SELECT user FROM UserEntity user " + "WHERE email in (:email) ");

        Query q = em.createQuery(sb.toString());

        q.setParameter("email", user.getEmail());

        UserEntity userFound = new UserEntity();

        try {
             userFound = (UserEntity) q.getSingleResult();
        }catch(NoResultException nre){
        }
        return userFound;

    }

But if I try to do inspect over (UserEntity) q.getSingleResult() I have an exception (translated from Spanish):

org.postgresql.util.PSQLException: ERROR: the operator does not exist: character varying = bigint
  Hint: Either operator match with the name and the argument´s type.
Could be necessary add explicit type convertions

It seems that the reason is that geo data are stored as "0101000020110F00003CDBA337DCC351C06D37C1374D374840" instead of "POINT(238271.194740 5070436.677042)".

Is that normal or there are any method to avoid this?

closed as off-topic by Ian Turton Jun 13 at 9:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – Ian Turton
If this question can be reworded to fit the rules in the help center, please edit the question.

  • which WKTReader are you using? – Ian Turton Jun 12 at 7:27
  • This one: com.vividsolutions.jts.io.WKTReader – Carlos FTG Jun 12 at 7:34
  • You need to rework this question to include a MRE (stackoverflow.com/help/minimal-reproducible-example) and a description of how you are connecting to the database. – Ian Turton Jun 13 at 9:41
  • This is not Well-Known Text (WKT) but a hexadecimal translation of Well-Known Binary (WKB). The column itself is a geometry type, which might not be recordable by your SQL client API. The solution is to use SELECT ST_AsText(geom) as wkt FROM table. – Vince Jun 13 at 12:36
  • At the end, it was easier than this, just use the type Point in the entity instead of Geometry – Carlos FTG Jun 14 at 18:28