I'm trying to use the Criteria Query trim() function to strip the leading zero's of a field in the database. The relevant part of the criteria query is:
final Expression<String> _code = cmm.get(CodeMasterMapping_.code);
builder.equal(builder.trim(Trimspec.LEADING, Character.valueOf('0'), _code), productCode)));
The SQL generated by this snippet is:
trim(LEADING 0 from codemaster3_.comm_code)=?)
This leads to the following exception from Postgres:
PSQLException: ERROR: function pg_catalog.ltrim(character varying, integer) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Expected generated SQL:
trim(LEADING '0' from codemaster3_.comm_code)=?)
|