I am trying to solve this problem. I want to pass a date, then all of those who have been selected using that NHibernate on that date should be recovered.
When I give order peacetime for the method given below, I do not want to exceed a date range, I just want to pass a date, neglect time, and if any item, The order exists with that pickup date.
Public IList & lt; ItemOrder & gt; GetItemOrderByCriteria (int? ItemNumber, int? Warehouse number, Dinanktaim Order) ({NHibernate.Irriteria criteria = NHibernate session. Kriattitretia (Taipf (Core.ItemOrder)); if (itemNumber.HasValue) criteria. Ready Krengn ( "Item" "item"). add (Abhiwyktikisi ( "items. item number", the item number. value)); if (Veyrhausnanbrkhaslav) criteria. Add prepared Krengn ( "Warehouse", "Warehouse"). (expression. Ic ("Warehouse. Wahrhausnumber", warehouse number); if (orderPickDate.HasValue) Andnd. Add (expression. A ( "OrdPickDate", order PicDate)); return criteria. List & lt; core. Item Order & gt; ();} catch (NHibernate.HibernateException he) {DataAccessException dae = new Detaavesaksepshn ( " How to set this column in the mapping: & quot; property name = "; Ord Piccrdet "column = is" ORD_PICK_DATE "type =" date "Not- null =" true "/ & gt;
when I see SQL Naibernet, it says the following (section 12/1/2009 12:00:00 AM):
WHERE this_.ORD_PICK_DATE = '2009-12-01T00: 00: 00.00'
If I try to run a query in a DB editor then I Receiving an error by saying "ORA-01861": The letter format does not match the string. "Should I take a different view in making my criteria?
The problem you are describing comes from the fact that a date type in Oracle There is a point in.
To search for a date you either:
- Compare with a date range (
between WHERE DT: D1 and D2
orWHERE dt> =: d1 and dt & lt; =: d2
) - Compare the "day" part of the date (eg
WHERE trunc (dt) =: d1
) - only store of dates in your part (all rows
trunc (dt) = dt
or in other words, all the rows are "12:00 AM"), which are applicable primarily to a column constraint Are. In that case,WHERE dt =: d1
will work.
In the case of all the trees, you will place a date type on both sides of the operation. I think that hibernation uses naturally the correct date when you specify "DATE". In SQL * Plus you'll obviously use the correct datatype with a to_date
function:
WHERE this_.ORD_PICK_DATE = to_date ( '2009-12-01 00 : 00 (00: 00 ',' yyyy-mm-dd hh24: mm: ss')
To express issues of performance: case (1) and (3) regular indexed usage The column will be able to do so while the case (2) will not be.
No comments:
Post a Comment