Foros de discusión

add custom query to CalendarBooking in another portlet, liferay 6.2

Ayatullah Abdulhakim, modificado hace 9 años.

add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 36 Fecha de incorporación: 12/05/13 Mensajes recientes
I want to add custom queries to a custom portlet that returns CalendarBooking objects, but i cannot retrieve them

this exception was raised:

com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.MappingException: Unknown entity: com.liferay.calendar.model.impl.CalendarBooking
at com.liferay.portal.dao.orm.hibernate.ExceptionTranslator.translate(ExceptionTranslator.java:30)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:189)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:168)
at com.liferay.portal.kernel.dao.orm.QueryUtil.list(QueryUtil.java:194)
at com.liferay.portal.kernel.dao.orm.QueryUtil.list(QueryUtil.java:162)
at com.asset.calendar.helper.service.persistence.CalendarHelperFinderImpl.getCalendarBookings(CalendarHelperFinderImpl.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:320)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at com.liferay.portal.dao.shard.advice.ShardPersistenceAdvice.invoke(ShardPersistenceAdvice.java:54)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy548.getCalendarBookings(Unknown Source)
at com.asset.calendar.helper.service.impl.CalendarHelperLocalServiceImpl.getCalendarBookings(CalendarHelperLocalServiceImpl.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ChainableMethodAdvice.invoke(ChainableMethodAdvice.java:56)
at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
at com.sun.proxy.$Proxy546.getCalendarBookings(Unknown Source)
at com.asset.calendar.helper.service.CalendarHelperLocalServiceUtil.getCalendarBookings(CalendarHelperLocalServiceUtil.java:283)
at com.asset.calendar.util.CalendarBookingUtil.getEvents(CalendarBookingUtil.java:37)
at com.asset.calendar.util.CalendarPortletUtil.getMonthEvents(CalendarPortletUtil.java:323)
at com.asset.calendar.util.CalendarPortletUtil.getEvents(CalendarPortletUtil.java:121)
at com.asset.calendar.portlet.CalendarPortlet.doView(CalendarPortlet.java:133)
at com.liferay.portal.kernel.portlet.LiferayPortlet.doDispatch(LiferayPortlet.java:213)
at com.liferay.util.bridges.mvc.MVCPortlet.doDispatch(MVCPortlet.java:323)
at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:604)
at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:677)
at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:379)
at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1230)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)
at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
at com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:655)
at com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:138)
at com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141)
at com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126)
at com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:120)
at com.liferay.portal.layoutconfiguration.util.PortletRenderer.render(PortletRenderer.java:72)
at com.liferay.portal.layoutconfiguration.util.RuntimePageImpl.doProcessTemplate(RuntimePageImpl.java:460)
at com.liferay.portal.layoutconfiguration.util.RuntimePageImpl.doDispatch(RuntimePageImpl.java:284)
at com.liferay.portal.layoutconfiguration.util.RuntimePageImpl.processTemplate(RuntimePageImpl.java:113)
at com.liferay.portal.layoutconfiguration.util.RuntimePageImpl.processTemplate(RuntimePageImpl.java:124)
at com.liferay.portal.layoutconfiguration.util.RuntimePageUtil.processTemplate(RuntimePageUtil.java:69)
at org.apache.jsp.html.portal.layout.view.portlet_jsp._jspService(portlet_jsp.java:553)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
at com.liferay.portal.action.LayoutAction.includeLayoutContent(LayoutAction.java:280)
at com.liferay.portal.action.LayoutAction.processLayout(LayoutAction.java:383)
at com.liferay.portal.action.LayoutAction.doExecute(LayoutAction.java:178)
at com.liferay.portal.action.LayoutAction.execute(LayoutAction.java:79)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at com.liferay.portal.struts.PortalRequestProcessor.process(PortalRequestProcessor.java:173)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at com.liferay.portal.servlet.MainServlet.callParentService(MainServlet.java:546)
at com.liferay.portal.servlet.MainServlet.service(MainServlet.java:523)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:293)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at com.liferay.portal.servlet.FriendlyURLServlet.service(FriendlyURLServlet.java:160)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.strip.StripFilter.processFilter(StripFilter.java:359)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.gzip.GZipFilter.processFilter(GZipFilter.java:123)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.secure.SecureFilter.processFilter(SecureFilter.java:293)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:263)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at com.liferay.portal.servlet.I18nServlet.service(I18nServlet.java:114)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:169)
at com.liferay.portal.servlet.filters.jsoncontenttype.JSONContentTypeFilter.processFilter(JSONContentTypeFilter.java:42)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.processFilter(VirtualHostFilter.java:320)
at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:59)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDoFilter(InvokerFilterChain.java:204)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:109)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:165)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.processDirectCallFilter(InvokerFilterChain.java:185)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:96)
at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.hibernate.MappingException: Unknown entity: com.liferay.calendar.model.impl.CalendarBookingImpl
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:693)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.getSQLLoadable(SQLQueryReturnProcessor.java:335)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.processRootReturn(SQLQueryReturnProcessor.java:376)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.processReturn(SQLQueryReturnProcessor.java:355)
at org.hibernate.loader.custom.sql.SQLQueryReturnProcessor.process(SQLQueryReturnProcessor.java:171)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:87)
at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:67)
at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:166)
at org.hibernate.impl.AbstractSessionImpl.getNativeSQLQueryPlan(AbstractSessionImpl.java:160)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
at com.liferay.portal.dao.orm.hibernate.SQLQueryImpl.list(SQLQueryImpl.java:177)
... 225 more
thumbnail
Andew Jardine, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hi Ayatullah,

Can you provide a little more explanation? What I think you are saying is that you have a series or CalendarBookings that are stored in Liferay already (created using the CalendarPortlet I assume?). You have now created your own plugin portlet and in that custom portlet you wish to pull the Calendar object data from the database to use in your custom plugin, but you are getting an exception.

Is that correct?

Can you share with us your code as well?
Ayatullah Abdulhakim, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 36 Fecha de incorporación: 12/05/13 Mensajes recientes
Andew Jardine:
Hi Ayatullah,

Can you provide a little more explanation? What I think you are saying is that you have a series or CalendarBookings that are stored in Liferay already (created using the CalendarPortlet I assume?). You have now created your own plugin portlet and in that custom portlet you wish to pull the Calendar object data from the database to use in your custom plugin, but you are getting an exception.

Is that correct?

Can you share with us your code as well?



Exactly that is what i want to do,

i added custom sql:
<sql id="com.asset.calendar.helper.service.persistence.CalendarHelperFinder.getCalendarBookings">
<![CDATA[
SELECT
{CalendarBooking.*}
FROM
CalendarBooking
WHERE
(groupId = ?)
AND
(
([$START_TIME$]=0 or startTime >= [$START_TIME$]) and ([$END_TIME$]=0 or startTime <= [$END_TIME$])
)

]]>
</sql>

i created a presistance class called: CalendarHelperFinderImpl and has this method:

import com.liferay.calendar.service.ClpSerializer;
public List<CalendarBooking> getCalendarBookings(long groupId, long startCalStartTime,long endCalStartTime,long[] calTypes,boolean personal,long userId,String searchText,String location,int start,int end){
Session session = null;
try {
//SessionFactory sessionFactory = (SessionFactory) PortalBeanLocatorUtil.locate("liferaySessionFactory");

session = openSession();//sessionFactory.openSession();
String sql = CustomSQLUtil.get(GET_CALENDAR_BOOKINGS);
sql=CustomSQLUtil.replaceAndOperator(sql, true);
sql = sql.replace("[$START_TIME$]",""+ startCalStartTime);
sql = sql.replace("[$END_TIME$]", ""+endCalStartTime);

SQLQuery q = session.createSQLQuery(sql);
q.setCacheable(false);
String servletContextName = ClpSerializer.getServletContextName();

BeanLocator beanLocator = com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.getBeanLocator(servletContextName);

Class<?> class_=beanLocator.getClassLoader().loadClass("com.liferay.calendar.model.impl.CalendarBookingImpl");

//Class<?> class_1=CalendarBooking.class;
q.addEntity("CalendarBooking", class_);

QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
List<CalendarBooking> calendarBookings = (List<CalendarBooking>) QueryUtil.list(q,getDialect(), start, end);
return calendarBookings;
}catch(Exception e){
e.printStackTrace();
}
return null;
}
thumbnail
Diego Morales, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 50 Fecha de incorporación: 26/11/13 Mensajes recientes
Try replacing this line:

String servletContextName = "calendar-portlet";
Ayatullah Abdulhakim, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 36 Fecha de incorporación: 12/05/13 Mensajes recientes
Diego Morales:
Try replacing this line:

String servletContextName = "calendar-portlet";



I tried this before emoticon


ClpSerializer class is com.liferay.calendar.service.ClpSerializer
thumbnail
Andew Jardine, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Ayatullah Abdulhakim:
Andew Jardine:
Hi Ayatullah,

Can you provide a little more explanation? What I think you are saying is that you have a series or CalendarBookings that are stored in Liferay already (created using the CalendarPortlet I assume?). You have now created your own plugin portlet and in that custom portlet you wish to pull the Calendar object data from the database to use in your custom plugin, but you are getting an exception.

Is that correct?

Can you share with us your code as well?



Exactly that is what i want to do,

i added custom sql:
<sql id="com.asset.calendar.helper.service.persistence.CalendarHelperFinder.getCalendarBookings">
<![CDATA[
SELECT
{CalendarBooking.*}
FROM
CalendarBooking
WHERE
(groupId = ?)
AND
(
([$START_TIME$]=0 or startTime >= [$START_TIME$]) and ([$END_TIME$]=0 or startTime <= [$END_TIME$])
)

]]>
</sql>

i created a presistance class called: CalendarHelperFinderImpl and has this method:

import com.liferay.calendar.service.ClpSerializer;
public List<CalendarBooking> getCalendarBookings(long groupId, long startCalStartTime,long endCalStartTime,long[] calTypes,boolean personal,long userId,String searchText,String location,int start,int end){
Session session = null;
try {
//SessionFactory sessionFactory = (SessionFactory) PortalBeanLocatorUtil.locate("liferaySessionFactory");

session = openSession();//sessionFactory.openSession();
String sql = CustomSQLUtil.get(GET_CALENDAR_BOOKINGS);
sql=CustomSQLUtil.replaceAndOperator(sql, true);
sql = sql.replace("[$START_TIME$]",""+ startCalStartTime);
sql = sql.replace("[$END_TIME$]", ""+endCalStartTime);

SQLQuery q = session.createSQLQuery(sql);
q.setCacheable(false);
String servletContextName = ClpSerializer.getServletContextName();

BeanLocator beanLocator = com.liferay.portal.kernel.bean.PortletBeanLocatorUtil.getBeanLocator(servletContextName);

Class<?> class_=beanLocator.getClassLoader().loadClass("com.liferay.calendar.model.impl.CalendarBookingImpl");

//Class<?> class_1=CalendarBooking.class;
q.addEntity("CalendarBooking", class_);

QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
List<CalendarBooking> calendarBookings = (List<CalendarBooking>) QueryUtil.list(q,getDialect(), start, end);
return calendarBookings;
}catch(Exception e){
e.printStackTrace();
}
return null;
}


What happens if you reference the Calendar interface, rather than the implementation class?

Meaning... change

Class<!--?--> class_=beanLocator.getClassLoader().loadClass("com.liferay.calendar.model.impl.CalendarBookingImpl");


to

Class<!--?--> class_=beanLocator.getClassLoader().loadClass("com.liferay.calendar.model.CalendarBooking");
Ayatullah Abdulhakim, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 36 Fecha de incorporación: 12/05/13 Mensajes recientes
I didn't try it, but the mapping of the custom query result need the model impl class not the model class.

anyway i will try it & tell you the result.

Thanks for your support.
thumbnail
Andew Jardine, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Ack! you are correct. I just did this yesterday -- not sure how I managed to forget so soon emoticon
thumbnail
Andew Jardine, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
... and just to double check, you placed the calendar-portlet-service.jar in your plugin WEB-INF/lib folder or in the TOMCAT_HOME/lib/ext (and restarted)?
Ayatullah Abdulhakim, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 36 Fecha de incorporación: 12/05/13 Mensajes recientes
Andew Jardine:
... and just to double check, you placed the calendar-portlet-service.jar in your plugin WEB-INF/lib folder or in the TOMCAT_HOME/lib/ext (and restarted)?



the calendar-portlet-service.jar is in my plugin.
thumbnail
Andew Jardine, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
Hmm -- looks like you are not the first to have this problem: https://www.liferay.com/community/forums/-/message_boards/message/18138317

That person ended up changing her CustomSQL to a DynamicQuery. Maybe give that a shot? Or do you need it to be a Custom SQL? In fact I think I read recently that as a best practice you should use a Dynamic Query when the service builder implementation is external to your project. I believe the same post mentioned that custom SQL is normally reserved for situations where you control the model.

Looking at your code again and thinking (read: guessing) what you might be doing, it feels like you have created a wrapper plugin around the calendar portlet to customize the results to your need. You could do this without the wrapper using Dynamic Queries -- at least this is something I have done often with other core entities.
Ayatullah Abdulhakim, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 36 Fecha de incorporación: 12/05/13 Mensajes recientes
Andew Jardine:
Hmm -- looks like you are not the first to have this problem: https://www.liferay.com/community/forums/-/message_boards/message/18138317

That person ended up changing her CustomSQL to a DynamicQuery. Maybe give that a shot? Or do you need it to be a Custom SQL? In fact I think I read recently that as a best practice you should use a Dynamic Query when the service builder implementation is external to your project. I believe the same post mentioned that custom SQL is normally reserved for situations where you control the model.

Looking at your code again and thinking (read: guessing) what you might be doing, it feels like you have created a wrapper plugin around the calendar portlet to customize the results to your need. You could do this without the wrapper using Dynamic Queries -- at least this is something I have done often with other core entities.



emoticon I will be a very very complex query, and it may cause an issue.

the main goal is retrieving CalendarBookings of certain Categories, Is there are any other solution except the custom query?
thumbnail
Andew Jardine, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
You could clone the project from github and make the necessary changes to customize your version of the Calendar Portlet.
thumbnail
Andew Jardine, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
OR! If it is a search option, you could write Index hooks to ensure that the category is added to the lucene index and then use a BooleanQuery to retrieve the calendar items your are looking for.

Or you could use the regular CalendarBookingLocalServiceUtil to retrieve all the calendar entries for your group in your date range and then loop over them to find the ones for the category you want. In fact, you could combine this with a model listener such that you could create a cache for each category that contains a list of calendar bookings. The model listener would update the cache as bookings are added/removed.

... I guess the bottom line is that there are many options emoticon
Ayatullah Abdulhakim, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 36 Fecha de incorporación: 12/05/13 Mensajes recientes
Andew Jardine:
OR! If it is a search option, you could write Index hooks to ensure that the category is added to the lucene index and then use a BooleanQuery to retrieve the calendar items your are looking for.

Or you could use the regular CalendarBookingLocalServiceUtil to retrieve all the calendar entries for your group in your date range and then loop over them to find the ones for the category you want. In fact, you could combine this with a model listener such that you could create a cache for each category that contains a list of calendar bookings. The model listener would update the cache as bookings are added/removed.

... I guess the bottom line is that there are many options emoticon



Nice ideas emoticon,, i will try customizing in the existing liferay calendar portlet.

Thanks for your support.
Ayatullah Abdulhakim, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Junior Member Mensajes: 36 Fecha de incorporación: 12/05/13 Mensajes recientes
The latest code on the github is liferay 7 emoticon
thumbnail
Andew Jardine, modificado hace 9 años.

RE: add custom query to CalendarBooking in another portlet, liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
You can change to a different branch. Look for a drop down in the upper left and change it to 6.2.x