Liferay Serivce Builder: Not able to run dynamic query -
i have 2 plugin portlets. first has service builder entities. second portlet using service's jar file execute dynamic query.
i using first's service jar in second plugin portlet interact database. in jar file there not impl class. thats why getting error impl class not found. below reference:
dynamicquery dynamicquery = dynamicqueryfactoryutil.forclass(xxx.class, portletclassloaderutil.getclassloader()); try { xxxlocalserviceutil.dynamicquery(dynamicquery); } catch (systemexception e1) { // todo auto-generated catch block e1.printstacktrace(); }
error: [dynamicqueryfactoryimpl:96] unable find model com.compass.model.impl.xxximpl java.lang.classnotfoundexception: com.compass.model.impl.xxximpl
nomal functions working fine of service builder
just don't use dynamicqueryfactoryutil xxxlocalserviceutil way
dynamicquery dynamicquery = xxxlocalserviceutil.dynamicquery() try { xxxlocalserviceutil.dynamicquery(dynamicquery); } catch (systemexception e1) { // todo auto-generated catch block e1.printstacktrace(); }
if want use factory have use interface model not impl of entity if have entity fooimpl sue foo.class , use classloder of service plugin portlet
classloader cl =(classloader) portletbeanlocatorutil.locate("services-portlet", "portletclassloader"); dynamicqueryfactoryutil.forclass(xxx.class, cl);
Comments
Post a Comment