Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Fahad v
Error in building service with arrayable-operator="OR" in liferay 6.2
20 août 2014 05:16
Réponse

Fahad v

Rang: Junior Member

Publications: 35

Date d'inscription: 13 juillet 2014

Publications Récentes

Hi,

I need to build a finder to search contact name by first and last
The Query should be
1fname like 'a' or lname like 'a'


i wrote the finder as shown below
1<finder name="ContactName" return-type="Collection" unique="false">
2   <finder-column name="firstName" case-sensitive="false" comparator="LIKE" arrayable-operator="OR"></finder-column>
3   <finder-column name="lastName" case-sensitive="false" comparator="LIKE" arrayable-operator="OR"></finder-column>
4</finder>


But i can see in
1*Persistence.findByContactName (keyword, keyword);

as
1
2Returns all the contacts where firstName LIKE ? and lastName LIKE ?.


why the query is build with "AND" not with "OR"

Please Help
im using Liferay 6.2 Version
emoticon
Nagendra Kumar Busam
RE: Error in building service with arrayable-operator="OR" in liferay 6.2
20 août 2014 12:08
Réponse

Nagendra Kumar Busam

Rang: Liferay Master

Publications: 653

Date d'inscription: 7 juillet 2009

Publications Récentes

AFAIK, when you declare two finder columns under a finder - it makes that columns ANDed not ORed. Probably better approach in this case for you is custom sql query

https://www.liferay.com/documentation/liferay-portal/6.2/development/-/ai/develop-custom-sql-queries-liferay-portal-6-2-dev-guide-04-en
Fahad v
RE: Error in building service with arrayable-operator="OR" in liferay 6.2
25 août 2014 21:57
Réponse

Fahad v

Rang: Junior Member

Publications: 35

Date d'inscription: 13 juillet 2014

Publications Récentes

Then the arrayable-operator attribute is of no use

1 <finder-column name="lastName" case-sensitive="false" comparator="LIKE" arrayable-operator="OR"></finder-column>

emoticonemoticonemoticon
Nagendra Kumar Busam
R: Error in building service with arrayable-operator="OR" in liferay 6.2
27 août 2014 05:07
Réponse

Nagendra Kumar Busam

Rang: Liferay Master

Publications: 653

Date d'inscription: 7 juillet 2009

Publications Récentes

In your case, yes. It is useful if you what to do multiple values checking within the same column - based on operator provided it works differently

Sent from my iPhone with Liferay.com Forums
Fahad v
RE: Error in building service with arrayable-operator="OR" in liferay 6.2
27 août 2014 05:22
Réponse

Fahad v

Rang: Junior Member

Publications: 35

Date d'inscription: 13 juillet 2014

Publications Récentes

Thanks Nagendra Kumar
I used the custom query to retrieve the data with or condition emoticon