[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Query for a Integer/int and treat it like a String (with LIKE %123%)
|
Hi!
I am in need to perform a search for some objects which are persited to my
database and contain Integers and int. The problem is, that i have to search
for "substrings" within these Numbers.
For example:
Let's assume I've got a Class "Machine" which contains a machineId (Integer)
and a machineName (String).
There are some Objects stored into the database:
machineId machineName
4711 My Machine 1
8711 My Other Machine
9741 Best Machine
Now i want to do something like this:
Query q = em.createQuery("SELECT m FROM Machine m WHERE m.machineId LIKE
:likeParam");
q.setParameter("likeParam", "%71%");
I want this query to return the machines with the id 4711 and 8711.
How can i achieve this?
Thanks in anticipation!
Best Regards,
chris
--
View this message in context: http://www.nabble.com/Query-for-a-Integer-int-and-treat-it-like-a-String-%28with-LIKE--123-%29-tp23535574p23535574.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.