Fórumok

Error in building service with arrayable-operator="OR" in liferay 6.2

thumbnail
Fahad v, módosítva 9 év-val korábban

Error in building service with arrayable-operator="OR" in liferay 6.2

Junior Member Bejegyzések: 35 Csatlakozás dátuma: 2014.07.14. Legújabb bejegyzések
Hi,

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


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


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

as

Returns 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
thumbnail
Nagendra Kumar Busam, módosítva 9 év-val korábban

RE: Error in building service with arrayable-operator="OR" in liferay 6.2

Liferay Master Bejegyzések: 678 Csatlakozás dátuma: 2009.07.07. Legújabb bejegyzések
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
thumbnail
Fahad v, módosítva 9 év-val korábban

RE: Error in building service with arrayable-operator="OR" in liferay 6.2

Junior Member Bejegyzések: 35 Csatlakozás dátuma: 2014.07.14. Legújabb bejegyzések
Then the arrayable-operator attribute is of no use

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

emoticonemoticonemoticon
thumbnail
Nagendra Kumar Busam, módosítva 9 év-val korábban

R: Error in building service with arrayable-operator="OR" in liferay 6.2

Liferay Master Bejegyzések: 678 Csatlakozás dátuma: 2009.07.07. Legújabb bejegyzések
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
thumbnail
Fahad v, módosítva 9 év-val korábban

RE: Error in building service with arrayable-operator="OR" in liferay 6.2

Junior Member Bejegyzések: 35 Csatlakozás dátuma: 2014.07.14. Legújabb bejegyzések
Thanks Nagendra Kumar
I used the custom query to retrieve the data with or condition emoticon