FreeMarker template error!

org.hibernate.QueryException: unexpected char: '#' [SELECT table FROM worldwide_partners_inc__wpi__dt_wpi_news AS table WHERE [#assign s_slug = util.getSlug()?substring(13)]
${hql.aliasName}.slug = ${hql.param("slug", s_slug)}]
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:250)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
	at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
	at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
	at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
	at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
	at net.proteusframework.ui.search.HQLResolver.createQuery(HQLResolver.java:127)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1042)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1021)
	at com.i2rd.domainmodel.extension.impl.DynamicTableModelExtension.getCollectionData(DynamicTableModelExtension.java:238)
	at com.i2rd.domainmodel.supplier.DefaultDomainModelMediator.getCollectionData(DefaultDomainModelMediator.java:556)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.handleTemplateSequenceModel(DomainModelInvocationHandler.java:391)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.invoke(DomainModelInvocationHandler.java:209)
	at com.sun.proxy.$Proxy204.get(Unknown Source)
	at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:105)
	at freemarker.core.DynamicKeyName._eval(DynamicKeyName.java:71)
	at freemarker.core.Expression.eval(Expression.java:83)
	at freemarker.core.ParentheticalExpression._eval(ParentheticalExpression.java:50)
	at freemarker.core.Expression.eval(Expression.java:83)
	at freemarker.core.DefaultToExpression._eval(DefaultToExpression.java:81)
	at freemarker.core.Expression.eval(Expression.java:83)
	at freemarker.core.Assignment.accept(Assignment.java:134)
	at freemarker.core.Environment.visit(Environment.java:325)
	at freemarker.core.Environment.visit(Environment.java:331)
	at freemarker.core.Environment.process(Environment.java:304)
	at com.i2rd.freemarker.component.FreeMarkerGenerator.render(FreeMarkerGenerator.java:267)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLPageGenerator.render(HTMLPageGenerator.java:466)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.Processor.processAndRender(Processor.java:300)
	at net.proteusframework.cms.controller.Processor.handle(Processor.java:235)
	at net.proteusframework.cms.controller.Cms.doPost(Cms.java:594)
	at net.proteusframework.cms.controller.Cms.doGet(Cms.java:538)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:294)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.ClientLog4JFilter.doFilter(ClientLog4JFilter.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
	at net.proteusframework.users.authentication.RecordAccessFilter.doFilter(RecordAccessFilter.java:77)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.cms.controller.CmsContextFilter.doFilter(CmsContextFilter.java:184)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.users.authentication.ProteusRememberMeProcessingFilter.doFilter(ProteusRememberMeProcessingFilter.java:100)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.internet.servlet.filter.HibernateSessionHandlerFilter.doFilter(HibernateSessionHandlerFilter.java:99)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:191)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
	at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.compression.CompressionFilter.doFilter(CompressionFilter.java:126)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	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:472)
	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:931)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
FreeMarker template error!

org.hibernate.QueryException: unexpected char: '#' [SELECT table FROM worldwide_partners_inc__wpi__dt_wpi_news AS table WHERE [#assign s_slug = util.getSlug()?substring(13)]
${hql.aliasName}.slug = ${hql.param("slug", s_slug)}]
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:250)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
	at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
	at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
	at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
	at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
	at net.proteusframework.ui.search.HQLResolver.createQuery(HQLResolver.java:127)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1042)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1021)
	at com.i2rd.domainmodel.extension.impl.DynamicTableModelExtension.getCollectionData(DynamicTableModelExtension.java:238)
	at com.i2rd.domainmodel.supplier.DefaultDomainModelMediator.getCollectionData(DefaultDomainModelMediator.java:556)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.handleTemplateSequenceModel(DomainModelInvocationHandler.java:391)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.invoke(DomainModelInvocationHandler.java:209)
	at com.sun.proxy.$Proxy204.get(Unknown Source)
	at freemarker.core.DynamicKeyName.dealWithNumericalKey(DynamicKeyName.java:105)
	at freemarker.core.DynamicKeyName._eval(DynamicKeyName.java:71)
	at freemarker.core.Expression.eval(Expression.java:83)
	at freemarker.core.ParentheticalExpression._eval(ParentheticalExpression.java:50)
	at freemarker.core.Expression.eval(Expression.java:83)
	at freemarker.core.DefaultToExpression._eval(DefaultToExpression.java:81)
	at freemarker.core.Expression.eval(Expression.java:83)
	at freemarker.core.Assignment.accept(Assignment.java:134)
	at freemarker.core.Environment.visit(Environment.java:325)
	at freemarker.core.Environment.visit(Environment.java:331)
	at freemarker.core.Environment.process(Environment.java:304)
	at com.i2rd.freemarker.component.FreeMarkerGenerator.render(FreeMarkerGenerator.java:267)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLPageGenerator.render(HTMLPageGenerator.java:466)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.Processor.processAndRender(Processor.java:300)
	at net.proteusframework.cms.controller.Processor.handle(Processor.java:235)
	at net.proteusframework.cms.controller.Cms.doPost(Cms.java:594)
	at net.proteusframework.cms.controller.Cms.doGet(Cms.java:538)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:294)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.ClientLog4JFilter.doFilter(ClientLog4JFilter.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
	at net.proteusframework.users.authentication.RecordAccessFilter.doFilter(RecordAccessFilter.java:77)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.cms.controller.CmsContextFilter.doFilter(CmsContextFilter.java:184)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.users.authentication.ProteusRememberMeProcessingFilter.doFilter(ProteusRememberMeProcessingFilter.java:100)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.internet.servlet.filter.HibernateSessionHandlerFilter.doFilter(HibernateSessionHandlerFilter.java:99)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:191)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
	at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.compression.CompressionFilter.doFilter(CompressionFilter.java:126)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	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:472)
	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:931)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
FreeMarker template error!

org.hibernate.QueryException: unexpected char: '#' [SELECT table FROM worldwide_partners_inc__wpi__dt_wpi_news AS table WHERE [#assign s_ob = (request.params.ob)!""]
[#if s_ob = 'oldest']
TO_CHAR(${hql.aliasName}.date, 'yyyyMMDD0000') <= '${util.getSlug()?substring(0,12)}'
[#else]
TO_CHAR(${hql.aliasName}.date, 'yyyyMMDD0000') >= '${util.getSlug()?substring(0,12)}'
[/#if] ORDER BY table.date ASC, table.slug ASC]
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:250)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
	at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
	at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
	at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
	at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
	at net.proteusframework.ui.search.HQLResolver.createQuery(HQLResolver.java:127)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1042)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1021)
	at com.i2rd.domainmodel.extension.impl.DynamicTableModelExtension.getCollectionData(DynamicTableModelExtension.java:238)
	at com.i2rd.domainmodel.supplier.DefaultDomainModelMediator.getCollectionData(DefaultDomainModelMediator.java:556)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.handleTemplateSequenceModel(DomainModelInvocationHandler.java:391)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.invoke(DomainModelInvocationHandler.java:209)
	at com.sun.proxy.$Proxy204.size(Unknown Source)
	at freemarker.core.BuiltInsForMultipleTypes$sizeBI._eval(BuiltInsForMultipleTypes.java:490)
	at freemarker.core.Expression.eval(Expression.java:83)
	at freemarker.core.Assignment.accept(Assignment.java:134)
	at freemarker.core.Environment.visit(Environment.java:325)
	at freemarker.core.Environment.visit(Environment.java:331)
	at freemarker.core.Environment.process(Environment.java:304)
	at com.i2rd.freemarker.component.FreeMarkerGenerator.render(FreeMarkerGenerator.java:267)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.component.generator.PassthroughGenerator.render(PassthroughGenerator.java:135)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLPageGenerator.render(HTMLPageGenerator.java:466)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.Processor.processAndRender(Processor.java:300)
	at net.proteusframework.cms.controller.Processor.handle(Processor.java:235)
	at net.proteusframework.cms.controller.Cms.doPost(Cms.java:594)
	at net.proteusframework.cms.controller.Cms.doGet(Cms.java:538)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:294)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.ClientLog4JFilter.doFilter(ClientLog4JFilter.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
	at net.proteusframework.users.authentication.RecordAccessFilter.doFilter(RecordAccessFilter.java:77)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.cms.controller.CmsContextFilter.doFilter(CmsContextFilter.java:184)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.users.authentication.ProteusRememberMeProcessingFilter.doFilter(ProteusRememberMeProcessingFilter.java:100)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.internet.servlet.filter.HibernateSessionHandlerFilter.doFilter(HibernateSessionHandlerFilter.java:99)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:191)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
	at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.compression.CompressionFilter.doFilter(CompressionFilter.java:126)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	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:472)
	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:931)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
FreeMarker template error!

org.hibernate.QueryException: unexpected char: '#' [SELECT table FROM worldwide_partners_inc__wpi__dt_wpi_news AS table WHERE [#assign s_ob = (request.params.ob)!""]
[#if s_ob = 'oldest']
TO_CHAR(${hql.aliasName}.date, 'yyyyMMDD0000') >= '${util.getSlug()?substring(0,12)}'
[#else]
TO_CHAR(${hql.aliasName}.date, 'yyyyMMDD0000') <= '${util.getSlug()?substring(0,12)}'
[/#if] ORDER BY table.date DESC, table.slug DESC]
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:250)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
	at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
	at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
	at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
	at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
	at net.proteusframework.ui.search.HQLResolver.createQuery(HQLResolver.java:127)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1042)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1021)
	at com.i2rd.domainmodel.extension.impl.DynamicTableModelExtension.getCollectionData(DynamicTableModelExtension.java:238)
	at com.i2rd.domainmodel.supplier.DefaultDomainModelMediator.getCollectionData(DefaultDomainModelMediator.java:556)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.handleTemplateSequenceModel(DomainModelInvocationHandler.java:391)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.invoke(DomainModelInvocationHandler.java:209)
	at com.sun.proxy.$Proxy204.size(Unknown Source)
	at freemarker.core.BuiltInsForMultipleTypes$sizeBI._eval(BuiltInsForMultipleTypes.java:490)
	at freemarker.core.Expression.eval(Expression.java:83)
	at freemarker.core.Assignment.accept(Assignment.java:134)
	at freemarker.core.Environment.visit(Environment.java:325)
	at freemarker.core.Environment.visit(Environment.java:331)
	at freemarker.core.Environment.process(Environment.java:304)
	at com.i2rd.freemarker.component.FreeMarkerGenerator.render(FreeMarkerGenerator.java:267)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.component.generator.PassthroughGenerator.render(PassthroughGenerator.java:135)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLPageGenerator.render(HTMLPageGenerator.java:466)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.Processor.processAndRender(Processor.java:300)
	at net.proteusframework.cms.controller.Processor.handle(Processor.java:235)
	at net.proteusframework.cms.controller.Cms.doPost(Cms.java:594)
	at net.proteusframework.cms.controller.Cms.doGet(Cms.java:538)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:294)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.ClientLog4JFilter.doFilter(ClientLog4JFilter.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
	at net.proteusframework.users.authentication.RecordAccessFilter.doFilter(RecordAccessFilter.java:77)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.cms.controller.CmsContextFilter.doFilter(CmsContextFilter.java:184)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.users.authentication.ProteusRememberMeProcessingFilter.doFilter(ProteusRememberMeProcessingFilter.java:100)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.internet.servlet.filter.HibernateSessionHandlerFilter.doFilter(HibernateSessionHandlerFilter.java:99)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:191)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
	at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.compression.CompressionFilter.doFilter(CompressionFilter.java:126)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	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:472)
	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:931)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
FreeMarker template error!

org.hibernate.QueryException: unexpected char: '#' [SELECT table FROM worldwide_partners_inc__wpi__dt_wpi_news AS table WHERE [#assign s_slug = util.getSlug()?substring(13)]
${hql.aliasName}.slug != ${hql.param("slug", s_slug)} ORDER BY table.date DESC]
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:250)
	at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:158)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:131)
	at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:93)
	at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:167)
	at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:301)
	at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:236)
	at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1836)
	at net.proteusframework.ui.search.HQLResolver.createQuery(HQLResolver.java:127)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1042)
	at com.i2rd.dynamic.table.DynamicTableDAO.getRows(DynamicTableDAO.java:1021)
	at com.i2rd.domainmodel.extension.impl.DynamicTableModelExtension.getCollectionData(DynamicTableModelExtension.java:238)
	at com.i2rd.domainmodel.supplier.DefaultDomainModelMediator.getCollectionData(DefaultDomainModelMediator.java:556)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.handleTemplateSequenceModel(DomainModelInvocationHandler.java:391)
	at com.i2rd.freemarker.domainmodel.DomainModelInvocationHandler.invoke(DomainModelInvocationHandler.java:209)
	at com.sun.proxy.$Proxy204.size(Unknown Source)
	at freemarker.core.Expression.isEmpty(Expression.java:210)
	at freemarker.core.BuiltInsForExistenceHandling$has_contentBI._eval(BuiltInsForExistenceHandling.java:112)
	at freemarker.core.BuiltInsForExistenceHandling$has_contentBI.evalToBoolean(BuiltInsForExistenceHandling.java:119)
	at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:48)
	at freemarker.core.Environment.visit(Environment.java:325)
	at freemarker.core.Environment.visit(Environment.java:331)
	at freemarker.core.Environment.process(Environment.java:304)
	at com.i2rd.freemarker.component.FreeMarkerGenerator.render(FreeMarkerGenerator.java:267)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLBoxGenerator.render(HTMLBoxGenerator.java:170)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.RenderChain.doChain(RenderChain.java:127)
	at net.proteusframework.cms.controller.PageElementChain.walk(PageElementChain.java:192)
	at net.proteusframework.cms.controller.RenderChain.renderChildElements(RenderChain.java:120)
	at net.proteusframework.cms.controller.HTMLPageGenerator.render(HTMLPageGenerator.java:466)
	at net.proteusframework.cms.controller.RenderChain.render_internal(RenderChain.java:174)
	at net.proteusframework.cms.controller.Processor.processAndRender(Processor.java:300)
	at net.proteusframework.cms.controller.Processor.handle(Processor.java:235)
	at net.proteusframework.cms.controller.Cms.doPost(Cms.java:594)
	at net.proteusframework.cms.controller.Cms.doGet(Cms.java:538)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:294)
	at net.proteusframework.cms.controller.Cms.service(Cms.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.ClientLog4JFilter.doFilter(ClientLog4JFilter.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:264)
	at net.proteusframework.users.authentication.RecordAccessFilter.doFilter(RecordAccessFilter.java:77)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.cms.controller.CmsContextFilter.doFilter(CmsContextFilter.java:184)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.users.authentication.ProteusRememberMeProcessingFilter.doFilter(ProteusRememberMeProcessingFilter.java:100)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at net.proteusframework.internet.servlet.filter.HibernateSessionHandlerFilter.doFilter(HibernateSessionHandlerFilter.java:99)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:191)
	at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:274)
	at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:148)
	at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:90)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at net.proteusframework.internet.servlet.filter.compression.CompressionFilter.doFilter(CompressionFilter.java:126)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	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:472)
	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:931)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:200)
	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:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)