<disclaimer>I am a JPA/Hib noob.</disclaimer>
I've got a table with some numeric columns, but I need to do some string comparisons using the LIKE phrase. So I've got a query like:
Code:
SELECT re FROM ResEntity re WHERE (CAST(re.x AS string) LIKE :match) OR (CAST(re.y AS string) LIKE :match)
While Hibernate will accept this query, calling q.set("match", "123%") only sets the first occurrence of "match", so I don't find all the rows. [BUG 1]
If I change the query to use :match1 and :match2, I get a NullPointerException on the createQuery() call. [BUG 2]
If I change the query to use ?1 and ?2, I get a NPE on the createQuery() call. [BUG 3]
Do I have 3 bugs, or am I just coming at this the wrong way.
I know there are other ways to get this done, but would like to understand why this doesn't work.
Thanks for any help!