java - How to use dynamic query to join liferay table with custom table? -
i have custom business table. have user liferay table.
how can join 2 tables using dynamic query?
here mycode example:
//sub query business dynamicquery businessquery = dynamicqueryfactoryutil .getdynamicqueryfactory().forclass(business.class, portletclassloaderutil.getclassloader()); businessquery.setprojection(propertyfactoryutil .forname("mappinguserid")); // root query user dynamicquery userquery = dynamicqueryfactoryutil.forclass( user.class, portalclassloaderutil.getclassloader()); criterion userquerycriterion = null; userquerycriterion = propertyfactoryutil.forname("userid").in( businessquery); userquerycriterion = restrictionsfactoryutil.or(userquerycriterion, propertyfactoryutil.forname("emailaddress").like(keyword)); userquerycriterion = restrictionsfactoryutil.or(userquerycriterion, propertyfactoryutil.forname("screenname").like(keyword)); userquery.add(userquerycriterion); list<user> list = userlocalserviceutil.dynamicquery(userquery);
problem here portalclassloader dont understand portletclassloader got error.
[basepersistenceimpl:244] caught unexpected exception org.hibernate.mappingexception [businessfinderimpl:516] null com.liferay.portal.kernel.exception.systemexception: org.hibernate.mappingexception: unknown entity: org.test.accountt.model.impl.businessimpl @ com.liferay.portal.service.persistence.impl.basepersistenceimpl.processexception(basepersistenceimpl.java:251) @ com.liferay.portal.service.persistence.impl.basepersistenceimpl.findwithdynamicquery(basepersistenceimpl.java:144) @ com.liferay.portal.service.base.userlocalservicebaseimpl.dynamicquery(userlocalservicebaseimpl.java:231)
any idea ?
Comments
Post a Comment