problem in date column with hibernate hql query

i hav a hql gets the data used between two dates..i wriiten a query like this
from com.cod.model.Billing where datecolumn between '2011-4-4' and '2011-4-20'

but i didn't get any results from this query ..i checked out this query in mysql with sql query.there it's workng fine..but if i write same query in hql it returns null results can any one say what's the problem in my query.thanx in advance

-------------Problems Reply------------

The dates mentioned have to be of the type java.util.Date and not String

Category:hibernate Views:1 Time:2011-04-29
Tags: hibernate hql

Related post

  • Hibernate HQL query by using like operator 2009-12-14

    Seu the following mapping @Entity public class User { private Integer id; @Id; private Integer getId() { return; } } Notice id is an Integer. Now i need this HQL query by using like operator Query query = sessionFactory.getCurrentSession().cr

  • Hibernate HQL Query : How to properly use ANY function in where clause? 2010-07-16

    I'm struggling to understand my error in an HQL query: public List<Pats> getIds(List<String> patIds) { Session session = getSession(); String hql = "from OurPats where patId = any (:patIds)"; // String hql = "from OurPats where patId in (

  • How to perform date operations in hibernate HQL 2009-06-24

    I want to perform data time operations using hibernate hql. I want to add and subtract two dates as well as I want to subtract 1 year or 1 month from a particular date. How is this possible using HQL in hibernate. Does anyone know about it? is there

  • Hibernate HQL Query : How to set a Collection as a named parameter of a Query with composite key? 2011-10-14

    Given the following HQL Query: from Foo foo where in (:fooIds) but here i have composite key in the Id ex we have two PK1 and pk2 as Id's. How can we implement this query.. how can i pass both paramets in setparameters function of query My que

  • Hibernate HQL Query : How to set a Collection as a named parameter of a Query? 2009-02-20

    Given the following HQL Query: FROM Foo WHERE Id = :id AND Bar IN (:barList) I set :id using the Query object's setInteger() method. I would like to set :barList using a List of objects, but looking at the Hibernate documentation and list of methods

  • How to write Hibernate HQL query which remove all "grand children" elements? 2011-03-14

    I have schools, which contains groups, which contains students. I would like to remove all students from specific school. In SQL I can write the following query: DELETE FROM students1 WHERE students1.group_id IN (SELECT id FROM group1 WHERE

  • Hibernate HQL Query Subselects or Joins 2011-06-29

    In a custom blog platform with User(s), Post(s), and Message(s). I know how to do an HQL query with distinct Users and their Post count. Also distinct Users and their Message count. But if I combine the two with "inner join" technique I get the same

  • Max date in an nHibernate HQL query 2011-11-30

    I am having some difficultly writing an hql query that will search a table for all the rows where certain criteria are met but I only want to return the row with the max date. For example the where clause of the query would be something like: column1

  • java hibernate: selecting the discriminator column in polymorphic hql query 2011-04-07

    In hibernate, I want to select the discriminator value. Something like select discriminator, id, name, age from Animal The idea is to send the result of this query to the client side, so that I can display a different icon based on the value of the d

  • Hibernate HQL query results problem 2010-11-18

    In the web application I'm developing I use this query "from Messages".Although there are 13 records in messages table at my database,when I print the results I get this: 1) id:0 mesname:bla message:bla,bla 2) id:0 mesname:bla1 message:bla1,bla1. In

  • Hibernate HQL query does not update the Lucene Index 2011-09-21

    I am using Hibernate 3.6.3 Final and Hibernate Search 3.4.1. I wrote an HQL delete query. The objects are deleted from the database but they are not removed from the Lucene Index after the transaction completes. Here is the query: Session session = f

  • Hibernate HQL query - complicated 2009-10-21

    I need to write some HQL to do the following... I have 3 tables: club, team and game (column names below) =School= -id(pk) -name =Team= -id(pk) -name -club_id(fk) =Game= -id(pk) -opposition -homeScore -awayScore -team_id(fk) I need to select the last

  • LINQ: How to exclude data columns from DataTable.ItemArray query? 2011-06-19

    Given a collection of data rows, IEnumerable of type DataRow, how can I query the collection so as to compute the Sum all the values in the collection (i.e. all the values of all the columns in all the rows) with the exception of two specific columns

  • constructing a Hibernate HQL query 2010-12-09

    How can this SQL query be written in HQL? select * from ( select a.*, rownum rnum from ( select * from TABLE_1 WHERE STATUS_FLAG = '105' ORDER BY payment_timestamp desc )a where rownum <= 10 ) where rnum >= 0 --------------Solutions------------

  • Having trouble with Hibernate HQL query containing nested aggregate functions 2014-03-05

    The following hql_query String works and delivers data records as expected. It gives me a list of lists, where the nested lists consist of a person pers and "the amount of persAccsBOs". hql_query_string = "" + "select distinct pers, count(persAccsBOs

  • With Hibernate/JPA query inHQL/JQL only how do I set where clause to last x days? 2011-02-02

    I am looking for the HQL equivalent of converting x amounts days from current timestamp to a queriable value. So like this sudo-HQL : from Newspaper as newspaper where newspaper.published < current_timestamp - days(:daysparam) And then daysparam i

  • Hibernate sub query exception 2011-05-14

    I m using Hibernate hql query but here i got some error i cant indentify why it occurs so can u please help out me to identify my mistake... My HQL Query : "select abc.examId,abc.districtId,count(abc.subjectByOptionalSubjectMain1) as General1,count(a

  • Extract a full timestamp (date included) from a Select query; Oracle 2011-06-13

    So I am trying to insert multiples rows of data from one table to another. I have done this; however, I am having an issue with some of my columns, specifically my date columns. When the query returns data it is missing the time component of the date

  • Why parameter substitution in HQL-Query failed but native type succeeds? 2011-08-08

    did one of you ever had the problem that parameter substitution in a HQL-Query didn't worked? I'm using hibernate for some, I think, simple queries getting entities from my MySQL Database. Here are the Queries: entityManager. createQuery("SELECT c FR

Copyright (C), All Rights Reserved.

processed in 0.135 (s). 11 q(s)