Hi,
I am new to hibernate and here is my problem:
I want to return companies which has both words "ABC" and "INVESTMENT" in their names.
I am using criteria API and trying to play with
crt.add(Restrictions.like("name", "ABC"));
crt.add(Restrictions.like("name","INVESTMENT");
The problem with above code is, the query is returning below results
1) ABC INVESTMENT CORPORATION
2) ABC INVESTMENTS COMPANY
3) ABCD INVESTMENT CORPORATION
4) ABCD INVESTMENTS CORPORATION
As per my requirement, I should return the names which contains the exact words. In the above results, system is supposed to send item#1 (not 2, 3, 4) only.
Any help is highly appreciated.
Thanks,
Gupta
|