Fórum

assetEntryQuery error (Bug?)

d lopez, modificado 11 Anos atrás.

assetEntryQuery error (Bug?)

New Member Postagens: 16 Data de Entrada: 24/01/13 Postagens Recentes
Good morning, I'm trying to perform a query to get a list of assetEntry belonging to categories that passes parameter as follows:

assetEntryQuery.setClassNameIds(classNameIds);
assetEntryQuery.setEnd(end);
assetEntryQuery.setStart(start);
assetEntryQuery.setAllCategoryIds(selectedCategories);
results = AssetEntryLocalServiceUtil.getEntries(assetEntryQuery);


The problem I have is that when the list of "selectedCategories" has more than one category ID does not return results, and the following error occurs:

Caused by: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.SQLGrammarException: could not execute query
at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:30)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:111)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:92)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.iterate(SQLQueryImpl.java:80)
... 227 more
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2545)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:99)
... 229 more
Caused by: org.postgresql.util.PSQLException: ERROR: error de sintaxis en o cerca de «EXISTS»
Position: 292
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
at org.hibernate.loader.Loader.doQuery(Loader.java:802)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2542)
... 236 more


What I see is an error when installing the sql, is a known bug in liferay? or am I missing a parameter that happen to assetEntryQuery?
Parikshit Sharma, modificado 11 Anos atrás.

RE: assetEntryQuery error (Bug?)

New Member Postagens: 21 Data de Entrada: 16/01/13 Postagens Recentes
d lopez:
Good morning, I'm trying to perform a query to get a list of assetEntry belonging to categories that passes parameter as follows:

assetEntryQuery.setClassNameIds(classNameIds);
assetEntryQuery.setEnd(end);
assetEntryQuery.setStart(start);
assetEntryQuery.setAllCategoryIds(selectedCategories);
results = AssetEntryLocalServiceUtil.getEntries(assetEntryQuery);


The problem I have is that when the list of "selectedCategories" has more than one category ID does not return results, and the following error occurs:

Caused by: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.exception.SQLGrammarException: could not execute query
at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:30)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:111)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:92)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.iterate(SQLQueryImpl.java:80)
... 227 more
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2545)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:99)
... 229 more
Caused by: org.postgresql.util.PSQLException: ERROR: error de sintaxis en o cerca de «EXISTS»
Position: 292
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1953)
at org.hibernate.loader.Loader.doQuery(Loader.java:802)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2542)
... 236 more


What I see is an error when installing the sql, is a known bug in liferay? or am I missing a parameter that happen to assetEntryQuery?


What value you are getting in "selectedCategories",Single value can be passed.but for more than 1 category we need to create proper
String array of long type and then we can set it ,So could you please check and look in to the values of selectedCategoies.
d lopez, modificado 11 Anos atrás.

RE: assetEntryQuery error (Bug?)

New Member Postagens: 16 Data de Entrada: 24/01/13 Postagens Recentes
Hi, thanks for the reply selectedCategories is a array of long:

long[] selectedCategories = new long[] {};