NHibernate: HQL and UserTypes as query parameters -


I am using a database that has a strange date format. I have written a user, which is in a strange format to transfer standard NAT datetime and it works fine.

I have used ICRTII queries generally but have decided to try IQuery to use HQ for this project. I went to a problem that does not translate the query parameter to the appropriate user type.

Example:

  IQuery query = session.CreateQuery ("Send shipment line as shipment from" OfflineShipmentLineItem. Extension where shipment. ShipmentDate =: date "); query .SetParameter ("Date", Date); Return Query.list & lt; Offline EmpowermentLitum & gt; ();  

is running up because the query on shipment. Instead, '4/28/2009 12:00:00' ends.

If I use ICRTARRIE instead it is OK Is:

  Aisiaraitiaiai criteria = session. Kriattitria (Taipf (offline empowerment line Itm)); Criteria.SetFetchMode ( "shipment", FetchMode.Eager); criteria Ksetfet Mood ( "extensions" , Fecmoda.agr); criteria. Kretealis ( "Add shipment", "shipment"); criteria. (expression. Ic. ( "shipment. shipment date", date)); return criteria. list & lt; offline empowerment Liaitm & Gt; ();  

Everything works well because the date is shipped Translated using UserType for NET. Respiration

What do I sign on HQL for nothing?

The I do not have time to myself, but adding a third argument SetParameter (Aitiaipii) try. Parameters are used by NHUtils.Custom (typeIF (YourIUserType))


Comments