-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: net.sf.hibernate.QueryException: in expected:
PostPosted: Mon Sep 04, 2006 11:59 pm 
Newbie

Joined: Fri Aug 04, 2006 5:54 am
Posts: 6
Hi,

I am getting a net.sf.hibernate.QueryException in Hibernate. The details are as posted below. Please help:


Hibernate version: 2.1

Mapping documents:
hbm.xml
======
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >

<hibernate-mapping>
<class name="entity.MtMergeHdr" table="MT_MERGE_HDR">
<id name="mergeHdrId" type="java.lang.Long" column="MERGE_HDR_ID">
<generator class="sequence">
<param name="sequence">SEQ_MT_MERGE_HDR_ID</param>
</generator>
</id>
<property
name="obsoleteUuid"
type="java.lang.Long"
column="OBSOLETE_UUID"
not-null="true"
/>
<property
name="activeUuid"
type="java.lang.Long"
column="ACTIVE_UUID"
not-null="true"
/>
<property
name="obsoleteFin"
type="java.lang.String"
column="OBSOLETE_FIN"
not-null="true"
/>
<property
name="activeFin"
type="java.lang.String"
column="ACTIVE_FIN"
not-null="true"
/>
<property
name="reqName"
type="java.lang.String"
column="REQ_NAME"
not-null="true"
/>
<property
name="reqDeptCd"
type="java.lang.String"
column="REQ_DEPT_CD"
not-null="true"
/>
<property
name="mergeResult"
type="java.lang.String"
column="MERGE_RESULT"
not-null="true"
/>
<property
name="createBy"
type="java.lang.String"
column="CREATE_BY"
not-null="true"
/>
<property
name="createDt"
type="java.util.Date"
column="CREATE_DT"
insert="false"
update="false"
not-null="true"
/>
<property
name="updBy"
type="java.lang.String"
column="UPD_BY"
insert="true"
update="true"
not-null="true"
length="9"
/>
<property
name="lastTimestp"
type="java.util.Date"
column="LAST_TIMESTP"
insert="false"
update="true"
not-null="true"
length="11"
/>
<property
name="mergeDt"
type="java.util.Date"
column="MERGE_DT"
insert="false"
update="false"
not-null="false"
/>
</class>
</hibernate-mapping>


Code :
StringBuffer strBuffer = new StringBuffer(
"Select mergeHdr.mergeHdrId,mergeHdr.activeFin,mergeHdr.obsoleteFin,mergeHdr.reqName,TO_CHAR(mergeHdr.mergeDt,'dd/mm/yyyy HH24:MI:SS'),mergeHdr.mergeResult ");
strBuffer.append("from MtMergeHdr mergeHdr ");
strBuffer.append("where TO_CHAR(mergeHdr.createDt,'dd/mm/yyyy') = '").append(filter.getTransactionDt()).
append("' ");
hqlQuery = strBuffer.toString();
List resultList = session.createQuery(hqlQuery).list();

Full stack trace of any exception :
net.sf.hibernate.QueryException: in expected: mergeHdr [Select mergeHdr.mergeHdrId,mergeHdr.activeFin,mergeHdr.obsoleteFin,mergeHdr.reqName,TO_CHAR(mergeHdr.mergeDt,'dd/mm/yyyy HH24:MI:SS'),mergeHdr.mergeResult from MtMergeHdr mergeHdr where TO_CHAR(mergeHdr.createDt,'dd/mm/yyyy') = '23/08/2006' ]
at net.sf.hibernate.hql.FromParser.token(FromParser.java:102)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:295)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1572)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1543)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:49)
at sg.gov.ciris.dao.MtMergeHdrDataGridDao.getNumberOfRecords(MtMergeHdrDataGridDao.java:75)
at sg.gov.ciris.ui.datagrid.ejb.DataGridSessionBean.getNumberOfRecords(DataGridSessionBean.java:63)
at sg.gov.ciris.ui.datagrid.ejb.DataGridSession_sby5tc_EOImpl.getNumberOfRecords(DataGridSession_sby5tc_EOImpl.java:364)
at sg.gov.ciris.ui.datagrid.delegate.DataGridDelegate.getNumberOfRecords(DataGridDelegate.java:81)
at sg.gov.ciris.ui.DataGrid.populateGrid(DataGrid.java:619)
at sg.gov.ciris.ui.DataGrid.validate(DataGrid.java:709)
at sg.gov.ciris.ui.DataGrid.getCurrentNumberOfRows(DataGrid.java:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.taglibs.standard.lang.jstl.ArraySuffix.evaluate(ArraySuffix.java:278)
at org.apache.taglibs.standard.lang.jstl.ComplexValue.evaluate(ComplexValue.java:107)
at org.apache.taglibs.standard.lang.jstl.BinaryOperatorExpression.evaluate(BinaryOperatorExpression.java:114)
at org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(ELEvaluator.java:204)
at org.apache.taglibs.standard.lang.jstl.ELEvaluator.evaluate(ELEvaluator.java:163)
at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:101)
at org.apache.taglibs.standard.lang.jstl.Evaluator.evaluate(Evaluator.java:129)
at org.apache.taglibs.standard.lang.support.ExpressionEvaluatorManager.evaluate(ExpressionEvaluatorManager.java:75)
at org.apache.taglibs.standard.tag.el.core.IfTag.condition(IfTag.java:58)
at javax.servlet.jsp.jstl.core.ConditionalTagSupport.doStartTag(ConditionalTagSupport.java:85)
at jsp_servlet._idm._enquiremergeresult.__mergeresultlist._jspService(mergeResultList.jsp:48)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at sg.gov.ciris.web.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:62)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.bea.wlw.netui.pageflow.PageFlowJspFilter.doFilter(PageFlowJspFilter.java:208)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:326)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.superForward(PageFlowRequestProcessor.java:1301)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor$DefaultHttpRedirector.forward(PageFlowRequestProcessor.java:1317)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.doForward(PageFlowRequestProcessor.java:1199)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.processForwardConfig(PageFlowRequestProcessor.java:1093)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at com.bea.wlw.netui.pageflow.PageFlowRequestProcessor.process(PageFlowRequestProcessor.java:650)
at com.bea.wlw.netui.pageflow.AutoRegisterActionServlet.process(AutoRegisterActionServlet.java:527)
at com.bea.wlw.netui.pageflow.PageFlowActionServlet.process(PageFlowActionServlet.java:152)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at sg.gov.ciris.web.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:62)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
[



Name and version of the database you are using: Oracle 9

Quote:

Thanks in advance.


Top
 Profile  
 
 Post subject: Why to_char()?
PostPosted: Tue Sep 05, 2006 9:57 am 
Regular
Regular

Joined: Wed Aug 24, 2005 11:49 am
Posts: 63
Can you change the query to just use a date-object as parameter value?
Code:
... where mergerHdr.createDt=:date

query.setParameter("date", dateValue)


If your date-column contains a range (eg. with time-part) you can try a 'between' with the same date at 0:00 and 23:59:59

_________________
Edwin van der Elst
Finalist IT Group


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.