Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
venka reddy
finder method with OR and LIKE condition
August 10, 2013 12:24 AM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

Hi,

<finder return-type="Collection" name="User_f_l">
<finder-column name="bookl1"></finder-column>
<finder-column name="book2"></finder-column>
</finder>

This finder method returns the collection of entries of book1 and book2.

I want either book1 or book2 entries how to can i manipulate it!! That to with like entries.
David H Nebinger
RE: finder method with OR and LIKE condition
August 10, 2013 7:39 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11478

Join Date: September 1, 2006

Recent Posts

You can easily do this using DynamicQuery.
venka reddy
RE: finder method with OR and LIKE condition
August 10, 2013 12:53 PM
Answer

venka reddy

Rank: Regular Member

Posts: 231

Join Date: March 23, 2011

Recent Posts

Thanks for reply,

Yes it can write in dynamic query.

One small question on this,
1. so instead of writing finder method every time and building service , can we use dynamic query instead?
2. what about the performance?
David H Nebinger
RE: finder method with OR and LIKE condition
August 10, 2013 2:06 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11478

Join Date: September 1, 2006

Recent Posts

I use DQ, but I do so in my XxxLocalServiceImpl classes. I do this because I'm implementing a service layer; external plugins using my service layer should not need to also know what my underlying data requirements are (even though the entity interfaces give a lot of that information away).

Performance isn't bad (it's really just a mechanism to help put together the underlying HQL query/SQL query, it's not really doing anything w/ the data itself), but folks seem to have trouble figuring out how to use it effectively at times. Not sure if that is a matter of documentation, crossing class loader boundaries, or what, but it does tend to be a handy little tool once you can effectively add it to your toolbox...