-->
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.  [ 1 post ] 
Author Message
 Post subject: search in between dates in hibernate
PostPosted: Thu Apr 10, 2008 9:21 am 
Newbie

Joined: Thu Apr 10, 2008 7:39 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html

Quote:

I want to retreive data based on date range i.e From date and To Date in the input form.
There is actually a Processing Business Date colum in the database table whose type is Date.This processing Business date should fall in between From Date and To Date .


My Process.config.hbm.xml file

<class name='ProcessHist' table='PROCESS_INPUT' >

<composite-id>
<key-property name='lookUpID' column="LKUP_ID"/>
</composite-id>

<property name='trgtSyst' column='TRGT_SYST' type="java.lang.String"/>
<property name='prcsBusDate' column='PRCS_BUSN_DATE' type="java.sql.Timestamp" />
<property name='prcsStatus' column='PRCS_STAT' type="java.lang.String" />
<property name='activeFlag' column='ACTV_FLAG' type="java.lang.String" />
<property name='userId' column='USER_ID' type="java.lang.String" />
<property name='modfDate' column='MODF_DATE' type="java.sql.Timestamp" />
<property name='modfId' column='MODF_ID' type="java.lang.String" />
<property name='makeTime' column='ENTR_DATE' type="java.sql.Timestamp" />
<property name='userRemarks' column='USER_REMR' type="java.lang.String" />

</class>

My Query looks like

<query name="ProcessHist.getRecords4Update">
<![CDATA[
from ProcessHist as hist where
('%' = :trgtSyst or upper(hist.trgtSyst) like :trgtSyst) and
(hist.prcsBusDate between (('%' = :frmDate) and ('%' = :toDate) ) and ('%' = :activeFlag or hist.activeFlag =:activeFlag ) and
hist.prcsStatus='Request Submitted'
order by hist.prcsBusDate desc

]]>
</query>
I am getting an exception could not execute the query on the screen.
Can anyone please help me in correcting the query?
Thanks in advance


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

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.