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: Found interface com.liferay.portal.dao.orm.custom.sql.CustomSQL
Hi All,I am using Liferay DXP 7.2.While calling custom sql i am getting below error
Found interface com.liferay.portal.dao.orm.custom.sql.CustomSQL, but class was expected
I am using @Reference
private CustomSQL _customSQL;
to read the custom sql file.
Can any body help me on this.
Found interface com.liferay.portal.dao.orm.custom.sql.CustomSQL, but class was expected
I am using @Reference
private CustomSQL _customSQL;
to read the custom sql file.
Can any body help me on this.
Hi Chris,
I tried that option getting below error.
java.lang.NoClassDefFoundError: Lcom/liferay/portal/dao/orm/custom/sql/CustomSQLUtil;
I tried that option getting below error.
java.lang.NoClassDefFoundError: Lcom/liferay/portal/dao/orm/custom/sql/CustomSQLUtil;
Hi pankaj,
Have you tried compileInclude to add dependency at runtime?
compileInclude group: 'com.liferay', name: 'com.liferay.portal.dao.orm.custom.sql', version: '1.0.3'
You can also include or exclude the transitive dependencies by,
compileInclude group: 'com.liferay', name: 'com.liferay.portal.dao.orm.custom.sql', version: '1.0.3', transitive:false
Have you tried compileInclude to add dependency at runtime?
compileInclude group: 'com.liferay', name: 'com.liferay.portal.dao.orm.custom.sql', version: '1.0.3'
You can also include or exclude the transitive dependencies by,
compileInclude group: 'com.liferay', name: 'com.liferay.portal.dao.orm.custom.sql', version: '1.0.3', transitive:false
krishna patel:
Nope, do not just try compileInclude randomly, and especially not on Liferay-delivered dependencies.
Hi pankaj,
Have you tried compileInclude to add dependency at runtime?
compileInclude group: 'com.liferay', name: 'com.liferay.portal.dao.orm.custom.sql', version: '1.0.3'
You can also include or exclude the transitive dependencies by,
compileInclude group: 'com.liferay', name: 'com.liferay.portal.dao.orm.custom.sql', version: '1.0.3', transitive:false
Coming back to the original post: @Reference provides a reference to a service - in order to use CustomSQL, I'd expect that you'll have to use an additional filter to determine which customSQL you'd like - that is provided that customSQL is registered as service at all.
I currently have no code available to check, but with a pure reference and no filter, this is definitely not what you expect.
I used com.liferay.portal.dao.orm.custom.sql.api dependence and its start working.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™