I am working with a JPQL query to filter some gateways ips ending with 1 (the column in the database is of type INET but on the entity is of type String):
...AND concat(c.ip,'') not LIKE '%.1'
THe query generated for this inside the application looks like this:
AND NOT (c_ip || ? LIKE ?))
I know using a native sql would work either with bitwise operations or with LIKE but I can't use native since I need a list and it won't allow it, tried it multiple ways.
I also tried to send through a parameter the value like this:
concat(c.ip,'') not LIKE :excludedValue
binding the value like this: query.setParameter("excludedValue","%.1");
And it doesn't work. The strange thing is that it works directly in my SQL IDE, with concat and like on the same data.
A bit of help would be much appreciated, thank you!