Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 477441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:35:28+00:00 2026-05-13T00:35:28+00:00

Here’s the problem I’m trying to solve. I want to pass a date, then

  • 0

Here’s the problem I’m trying to solve. I want to pass a date, then retrieve all itemorders that were picked on that date using NHibernate.

When I pass a orderPickDate to the method below, it never comes back with a result. I don’t want to pass a date range, I just want to pass a single date, ignore the time, and if any itemOrders exist with that pick date return them.

public IList<ItemOrder> GetItemOrderByCriteria(int? itemNumber, int? warehouseNumber, DateTime? orderPickDate)
    {
        try
        {
            NHibernate.ICriteria criteria = NHibernateSession.CreateCriteria(typeof(Core.ItemOrder));

            if (itemNumber.HasValue)
                criteria.CreateCriteria("Item", "Item").Add(Expression.Eq("Item.ItemNumber", itemNumber.Value));


            if (warehouseNumber.HasValue)
                criteria.CreateCriteria("Warehouse", "Warehouse").Add(Expression.Eq("Warehouse.WarehouseNumber", warehouseNumber));

            if (orderPickDate.HasValue)
                criteria.Add(Expression.Eq("OrdPickDate", orderPickDate));

            return criteria.List<Core.ItemOrder>();
        }
        catch (NHibernate.HibernateException he)
        {
            DataAccessException dae = new DataAccessException("NHibernate Exception", he);
            throw dae;
        }

    }

Here’s how this column is set up in the mapping:

<property name="OrdPickDate" column="ORD_PICK_DATE" type="date" not-null="true"/>

When I look at the sql nhibernate creates, it adds the following where clause(I passed it 12/1/2009 12:00:00 AM):

WHERE  this_.ORD_PICK_DATE = '2009-12-01T00:00:00.00'

If I try to run the query in a db editor I get an error saying “ORA-01861: literal does not match format string.” Should I be taking a different approach in creating my criteria?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:35:28+00:00Added an answer on May 13, 2026 at 12:35 am

    the problem you are describing comes from the fact that in Oracle a DATE type is a point in time. It always has the time component, even if sometimes it is not displayed (the time component is hidden).

    To perform a date search you would either:

    1. compare with a range of date (WHERE dt BETWEEN :d1 AND :d2 or WHERE dt >= :d1 AND dt <= :d2)
    2. compare the “day” portion of the date (for example WHERE trunc(dt) = :d1)
    3. store only the date portion in your column (i-e for all rows trunc(dt)=dt or in other words all rows are at “12:00AM”), preferably enforced by a column constraint. The WHERE dt = :d1 in that case would work.

    In all tree cases you would put a date type at both sides of the operand. I suppose Hibernate naturally uses the right datatype when you specify “DATE”. In SQL*Plus, you would explicitely use the right datatype with a to_date function:

    WHERE  this_.ORD_PICK_DATE = to_date('2009-12-01 00:00:00', 
                                         'yyyy-mm-dd hh24:mm:ss')
    

    To adress performance issues: case (1) and (3) will be able to use regular indexes on the column whereas case (2) will not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a complete example. I want to forbid using A::set from objects casted
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here my problem: @Assert\Regex( * pattern=/^[A-Za-z0-9][A-Za-z0-9\]*$/, * groups={creation, creation_logged} * ) I'm using the
Here's a coding problem for those that like this kind of thing. Let's see
Here's the flow that I am trying to achieve: 1) User uploads an audio
Here is another spoj problem that asks how to find the number of distinct
Here is my problem...I have a page that loads a list of clients and
Here's my proposed (very simplified to illustrate the problem space) design for a C#
Here the total height of all <div> 's are 900 pixels, but the jQuery
Here's the deal: I'm in the process of planning a mid-sized business application that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.