Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
d lopez
dynamic query error
January 29, 2013 1:08 AM
Answer

d lopez

Rank: New Member

Posts: 16

Join Date: January 24, 2013

Recent Posts

Hi, I'm using the following dynamic query:

DynamicQuery consulta =
DynamicQueryFactoryUtil.forClass(JournalArticle.class, PortalClassLoaderUtil.getClassLoader());

Criterion criterio1 = RestrictionsFactoryUtil.eq("resourceprimkey", 17622);
consulta.add(criterio1);
List<JournalArticle> resultado = JournalArticleLocalServiceUtil.dynamicQuery(consulta);

But I worked and this error: Caught unexpected exception org.hibernate.QueryException

What is happening?

Thanks.
Juhi Kumari
RE: dynamic query error
January 29, 2013 1:45 AM
Answer

Juhi Kumari

Rank: Expert

Posts: 347

Join Date: December 12, 2011

Recent Posts

Hi,

Column name is not matching that's why you are getting this error. Use this
1Criterion criterio1 = RestrictionsFactoryUtil.eq("resourcePrimKey", 17622);


Regards
Juhi
d lopez
RE: dynamic query error
January 29, 2013 2:49 AM
Answer

d lopez

Rank: New Member

Posts: 16

Join Date: January 24, 2013

Recent Posts

Thanks, it works! emoticon