Whereas I had no problem with the CustomSQLUtil class in Liferay 6.2, I meet a problem with the new version of this class in Liferay 7. Indeed, the get method returns null instead of the expected query.
Does someone has reproduced this ?
Here is the description for my last test in Eclipse Mars :
- In my Liferay workspace, I added the following line in the build.gradle of the service module
compileOnly group: "com.liferay", name: "com.liferay.portal.dao.orm.custom.sql", version: "1.0.5"
After a gradle refresh, I am able to use the CustomSQLUtil class in my FooFinderImpl class to retrieve the appropriate query.
This query has been written in a default.xml file which is dropped into the src/custom-sql folder as mentionned in the Liferay 7 documentation :
https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/custom-sql
I've tried with many places (in META-INF, in ressources..), I've even tried to extend the CustomSQL native class to get the configuration, but the get method of the CustomSQLUtil class returns always null instead of the sql query.
PS : I've noticed that this new "CustomSQLUtil.get" method now takes 2 parameters, a class is requested in addition to the query id. In this class parameter, I put the "Foo.class" value.
Does someone know if there is a configuration to do ? Does the classpath or bundlecontext has to be configured ?