留言板
case insensitive Dynamic Query
Hi Everyone,
Here is my dynamic query:
I would like the search to be case insensitive. Is it possible with DynamicQuery? Do I have to add something in the service builder?
TIA,
Flor.
Here is my dynamic query:
DynamicQuery query = DynamicQueryFactoryUtil.forClass(MessageSource.class);
query.add(PropertyFactoryUtil.forName("resourceValue").like("%" + resourceValue + "%"));
query.add(PropertyFactoryUtil.forName("resourceBundle").eq(resourceBundle));
I would like the search to be case insensitive. Is it possible with DynamicQuery? Do I have to add something in the service builder?
TIA,
Flor.
Hi,
Look at this link:
http://www.liferay.com/community/forums/-/message_boards/message/3936565
Look at this link:
http://www.liferay.com/community/forums/-/message_boards/message/3936565
Florencia Gadea,修改在11 年前。
RE: case insensitive Dynamic Query
Regular Member 帖子: 146 加入日期: 12-3-27 最近的帖子Alireza Zare:
Hi,
Look at this link:
http://www.liferay.com/community/forums/-/message_boards/message/3936565
Hi!
Thank you, it worked! I was supposed to use RestrictionsFactoryUtil instead of PropertyFactoryUtil.
This is how my query ended up:
DynamicQuery query = DynamicQueryFactoryUtil.forClass(MessageSource.class);
query.add(RestrictionsFactoryUtil.ilike("resourceValue", "%" + resourceValue + "%"));
query.add(RestrictionsFactoryUtil.ilike("resourceBundle", resourceBundle));
Best regards!
Flor
Hitoshi Ozawa,修改在11 年前。
RE: case insensitive Dynamic Query
Liferay Legend 帖子: 7942 加入日期: 10-3-24 最近的帖子
Have you tried using "ilike" instead of "like"