Okay, what I am trying to do is set up a search based on three fields. One is an integer, the other two are strings.
I have a working
EJB 3.0 Entity Bean and a stateless session bean in front of it. What I want to do is set up a named query that I can call to perform the search.
My problem is that I can not find a way to do "LIKE" with the Integer field. It works fine with the
String but not with the Integers.
I want to be able to type in "21" and return all results with "21" ANYWHERE in the integer field (321, 213, 113211, etc).
Here is what I've tried:
@NamedQuery(name="findRoyaltyContractLikeRoyaltyContractKey",
query="SELECT OBJECT(rc) FROM RoyaltyContractBean rc " +
"JOIN rc.royaltyContractOwner rco " +
"WHERE (rc.royaltyContractId LIKE :id) " +
"AND (rco.supplierCode LIKE
wner) " +
"AND (rc.vendor LIKE :vendor)")
The royaltyContractId being the integer field that I am having trouble with. Is there a trick to getting LIKE to work with Integers in EJBQL?
Thanks in advance for your time!