Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Umer Sayeed
Sql Not Equal to...,
January 2, 2013 3:03 AM
Answer

Umer Sayeed

Rank: Junior Member

Posts: 51

Join Date: August 8, 2012

Recent Posts

Hi All...,

How to use dynamic query for (NOT EQUAL TO) in liferay..,
Eg..,
SELECT * FROM table where userid!='10';

Thanks and Regards,
Ummer Sayeed.
Vishal Panchal
RE: Sql Not Equal to...,
January 2, 2013 3:28 AM
Answer

Vishal Panchal

Rank: Expert

Posts: 280

Join Date: May 20, 2012

Recent Posts

Hi ,

you may try below code it will work for you.

DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Library.class);
dynamicQuery.add(RestrictionsFactoryUtil.like("name", "vishal"));
dynamicQuery.add(RestrictionsFactoryUtil.ne("surName", "panchal"));


Thanks&Regards,
Vishal R. Panchal
Rewati Raman
RE: Sql Not Equal to...,
January 2, 2013 3:33 AM
Answer

Rewati Raman

Rank: Junior Member

Posts: 97

Join Date: February 24, 2012

Recent Posts

hi Umer,

hope below code will help you

1
2DynamicQuery dq = DynamicQueryFactoryUtil.forClass(User.class, PortalClassLoaderUtil.getClassLoader());
3dq.add(PropertyFactoryUtil.forName("userId").ne(1233));
4List<User> userList=UserLocalServiceUtil.dynamicQuery(dq);




Regards,
Rewati Raman