Liferay CustomSQL table doesn't exist -
i have service entity declaration follows:
<entity name="mycontentrepo" local-service="true" remote-service="true" table="contentrepo"> </entity>
i trying use custom sql fetch details:
session = opensession(); string sqlquerystring = customsqlutil.get("query_id"); sqlquery query = session.createsqlquery(sqlquerystring); query.addentity("mycontentrepo", mycontentrepoimpl.class); querypos qpos = querypos.getinstance(query); qpos.add("someparameter"); list = (list<mycontentrepo>) query.list();
but following error upon execution:
08:02:26,640 error [http-bio-8090-exec-72][jdbcexceptionreporter:82] table 'mysqldb.mycontentrepo' doesn't exist com.liferay.portal.kernel.dao.orm.ormexception: org.hibernate.exception.sqlgrammarexception: not execute query
the query taking name of entity declared not table="contentrepo". can tell me how bypass issue?
addentity once sqlquery has been translated querypos. change code given below:
session = opensession();
string sqlquerystring = customsqlutil.get("query_id"); sqlquery query = session.createsqlquery(sqlquerystring);
querypos qpos = querypos.getinstance(query); qpos.add("someparameter");
query.addentity("mycontentrepo", mycontentrepoimpl.class); list = (list<mycontentrepo>) query.list();
Comments
Post a Comment