on 2019 Sep 02 9:57 PM
My code :
private static final String Query_EmailAddress_From_B2BUnit = "SELECT {" + DNSB2BUnitPreferencesModel.EMAILADDRESS + "}" + " FROM {" + DNSB2BUnitPreferencesModel._TYPECODE + "}" + " WHERE {" + DNSB2BUnitPreferencesModel.B2BUNIT + "}=?b2bUnit";
@Override public String getEmailAddressesForB2BUnit(final B2BUnitModel b2bUnit) { final FlexibleSearchQuery fQuery = new FlexibleSearchQuery(Query_EmailAddress_From_B2BUnit); fQuery.addQueryParameter("b2bUnit", b2bUnit); final SearchResult<String> result = flexibleSearchService.search(fQuery); final String emailAddressesList = result.getResult().get(0); return emailAddressesList; }
It is giving me search failure because of : Caused by: de.hybris.platform.jalo.flexiblesearch.FlexibleSearchException: SQL search error - Fail to convert to internal representation query = 'SELECT item_t0.p_emailaddress FROM dnsb2bunitpreferences item_t0 WHERE ( item_t0.p_b2bunit =?) AND (item_t0.TypePkString=? )', values = [8806611648517, 8796156788818]
Though in HAC below query is running : select {emailAddress} from {DNSB2BUnitPreferences} where {b2bUnit}='8806611648517'
No idea why it is failing for me , i see no mismatch of types as well
NOTE: Using oracle DB.
Request clarification before answering.
hi Mohit,
please check below the right version of method you are trying to implement:
private static final String query =
"SELECT {" + DNSB2BUnitPreferencesModel.EMAILADDRESS + "}"
+ " FROM {" + DNSB2BUnitPreferencesModel._TYPECODE + "}"
+ " WHERE {" + DNSB2BUnitPreferencesModel.B2BUNIT + "}=?b2bUnit";
@Override
public String getEmailAddressesForB2BUnit(final B2BUnitModel b2bUnit) {
final FlexibleSearchQuery fsq = new FlexibleSearchQuery(query);
fsq.addQueryParameter("b2bUnit", b2bUnit);
fsq.setResultClassList(Collections.singletonList(String.class));
final SearchResult<String> searchResult = flexibleSearchService.search(fsq);
final List<String> result = searchResult.getResult();
return !result.isEmpty() ? result.get(0) : "";
}
Regards,
Igor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.