Concatenating strings using JPA and MS SQL without CONCAT function
765440Apr 8 2010 — edited Apr 9 2010Hi all,
I have the following question. I have a query like this +'select e from Entity e where concat(e.field1,e.field2)='alabala''+ but the MS SQL doesn't have built-in function concat* (only '+' is available for concatenating strings). On the other hand if I replace the concat function in my JPQL query with '+' I get exception that the operands of the operator '+' are not of numeric type. Can you help me with the solution of this problem I have? One possible workaround could be to make additional column in the table with the value "field1+field2" but I prefer not to do that. What is more I think this is pretty common requirement and the solution should be easy I hope :)