postgresql – Query generated by Hibernate is incorrect for JSON type

I am using a Named Query to call a Function in Postgresql. The function takes JSON as an Input but when I pass the query to JPA it strips of 1 of the colons resulting in an incorrect query that is generated.

Here is my code

    query = entityManager.createNativeQuery("select * from transfer_validate('{"a":"100","b":"200"}'::json,'{"a":"100","b":"200"}'::json);");
    query.getResultList();

Below is how the Function is created:

CREATE OR REPLACE FUNCTION transfer_validate(_d json, _l json)

This is the error that is generated :

org.postgresql.util.PSQLException: ERROR: syntax error at or near ":"
  Position: 67

Below is the SQL that is generated for Postgres in Hibernate logs

select * from transfer_validate('{"a":"100","b":"200"}':json,'{"a":"100","b":"200"}':json);

You can clearly notice that ::json is replaced by :json and hence the error.

How can I correct this ?

thanks.