Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Interface Error CustomSQL
Hi,
I followed this and got a weird error, i din't found it anywhere before :
I tried all i found about CustomSQL on the net, when i replace CustomSQL with CustomSQLUtil i have an error returning :
I realy don't know what to do, the package is in my dependencies' folder, i can open the CustomSQL* classes but i can't use any of their methods
Help !
here is the part of my code wich don't work :
I followed this and got a weird error, i din't found it anywhere before :
2019-03-15 08:52:20.145 ERROR [http-nio-8080-exec-8][JSONWebServiceServiceAction:116] Found interface com.liferay.portal.dao.orm.custom.sql.CustomSQL, but class was expected
I tried all i found about CustomSQL on the net, when i replace CustomSQL with CustomSQLUtil i have an error returning :
2019-03-15 08:50:31.324 ERROR [http-nio-8080-exec-4][JSONWebServiceServiceAction:116] com/liferay/portal/dao/orm/custom/sql/CustomSQLUtil
I realy don't know what to do, the package is in my dependencies' folder, i can open the CustomSQL* classes but i can't use any of their methods
Help !
here is the part of my code wich don't work :
public static final String FIND_BY_ROLES_ID_AND_PORTLET_ID_AND_ENTITY =
PermissionFinder.class.getName() +
".findByRolesIdAndPortletIdAndEntity";
@ServiceReference(type=CustomSQL.class)
private CustomSQL _customSQL;
public List<Permission> findByRolesIdAndPortletIdAndEntity(long[] roleIds, String portletId, String entity){
Session session = null;
try {
session = openSession();
//System.out.println(CustomSQLUtil.class);
String sql = _customSQL.get(getClass(), FIND_BY_ROLES_ID_AND_PORTLET_ID_AND_ENTITY);
System.out.println("La Requete : "+sql);
SQLQuery q = session.createSQLQuery(sql);
q.setCacheable(false);
q.addEntity("agiirpermission", PermissionImpl.class);
System.out.println("La SQL Query : "+q);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(roleIds);
qPos.add(portletId);
qPos.add(entity);
return (List<Permission>) QueryUtil.list(q, getDialect(), 0, 0);
}
catch (Exception e) {
try {
throw new SystemException(e);
}
catch (SystemException se) {
se.printStackTrace();
}
}
finally {
closeSession(session);
}
return new ArrayList<Permission>();
}
This works for me:
and my bnd:
What's the full stacktrace when you try that?
import com.liferay.portal.dao.orm.custom.sql.CustomSQLUtil;
...
CustomSQLUtil.get(getClass(), "xxx")
and my bnd:
compileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.0"
What's the full stacktrace when you try that?
When I use CustomSqlUtil the error is worst, just give me this :
I realy don't understand what i did wrong
2019-03-20 08:29:23.791 ERROR [http-nio-8080-exec-2][JSONWebServiceServiceAction:116] com/liferay/portal/dao/orm/custom/sql/CustomSQLUtilI don't have anything else and it don't work neither. I changed my dependencie like yours but still the same.
I realy don't understand what i did wrong
Ok i changed the import like this :
compileInclude group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.0"So i would say that if I import 1.0.3 it don't work for me but 1.0.0 work ? that's realy weird but thank you for your help !
That's strange, maybe your runtime environment doesn't have 1.0.3? Anyway, glad it's working now

FYI, just ran into this error on 7.1 which was caused by a wrong module import name:
good:
compileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql.api", version: "1.0.0"
bad:
compileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.0"
good:
compileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql.api", version: "1.0.0"
bad:
compileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.0"
I don't know because for me thi worked :
But this didn't worked :
compileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.0"
But this didn't worked :
compileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.3"
I have no idea where it come from, i didn't tried with sql.api ...
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™