Hi pramod,
I have tried the way given in the hibernate doc. Since I have got associations, I need to perform the search with an or operation instead of and (by default). Below is my sql track for your reference.
[code]
Hibernate: select this_.COMPANY_ID as COMPANY1_35_1_, this_.STATUS as STATUS35_1
_, this_.COMPANY_NAME as COMPANY3_35_1_, this_.SEARCH_NAME as SEARCH4_35_1_, thi
s_.SORT_NAME as SORT5_35_1_, this_.PHONE_NUMBER as PHONE6_35_1_, this_.PHONE_EXT
ENSION as PHONE7_35_1_, this_.FAX_NUMBER as FAX8_35_1_, this_.FAX_EXTENSION as F
AX9_35_1_, this_.LANGUAGE_PREFERENCE as LANGUAGE10_35_1_, this_.SUPPLIER_EXCEPTI
ON as SUPPLIER11_35_1_, this_.CAGE_CD as CAGE12_35_1_, this_.DUNS as DUNS35_1_,
this_.ENTERED_BY_USER_ID as ENTERED14_35_1_, this_.ENTERED_DATE as ENTERED15_35_
1_, this_.UPDATED_BY_USER_ID as UPDATED16_35_1_, this_.UPDATED_DATE as UPDATED17
_35_1_, this_.COMPANY_TYPE as COMPANY18_35_1_, a1_.ADDRESS_ID as ADDRESS1_32_0_,
a1_.COMPANY_ID as COMPANY2_32_0_, a1_.COUNTRY_CODE as COUNTRY3_32_0_, a1_.MAIL_
STOP as MAIL4_32_0_, a1_.PO_BOX as PO5_32_0_, a1_.SUITE_APARTMENT as SUITE6_32_0
_, a1_.STREET as STREET32_0_, a1_.CITY as CITY32_0_, a1_.POSTAL_CODE as POSTAL9_
32_0_, a1_.ENTERED_BY_USER_ID as ENTERED10_32_0_, a1_.ENTERED_DATE as ENTERED11_
32_0_, a1_.UPDATED_BY_USER_ID as UPDATED12_32_0_, a1_.UPDATED_DATE as UPDATED13_
32_0_, a1_.STATE_ID as STATE14_32_0_ from EAN_COMPANY this_, EAN_COMPANY_ADDRESS
a1_ where this_.COMPANY_ID=a1_.COMPANY_ID and ([b]this_.SEARCH_NAME like ? or this
_.COMPANY_TYPE like ?) and a1_.CITY=? and a1_.COUNTRY_CODE=?[/b]
[/code]
My criteria entered by the user are highlighted in bold above. You can notice and being performed. I need an OR operation there. Any idea to proceed with this................
With thanks,
Amutha
|