Questions tagged [nhibernate-criteria]

The NHibernate Criteria API allows performing dynamic, object oriented queries in NHibernate.

Using the criteria API is one way to perform queries in NHibernate. Its strength is on writing dynamic queries at runtime. It lacks some features compared to HQL, for instance creation of cross products and joining objects on arbitrary properties.

Related:

  • QueryOver is a successor of Criteria, which provides more type safety at compile time, but is still base on Criteria.
  • Linq To NHibernate once based on Criteria, but had been rewritten to use HQL in later versions.

References:

286 questions
0
votes
1 answer

How to use NHibernate DtachedCriteria sub queries to filter by list of referenced entities properties?

I want the outcome to be a single sql statement. I have the following structure: public class B { public virtual int Id { get; set; } public virtual int BNumber { get; set; } } public class A { public virtual int Id { get; set; } …
Adam Tal
  • 5,911
  • 4
  • 29
  • 49
0
votes
1 answer

How can i create a criteria for This SQL

I Stuck in this query. If any body know the Criteria of NHibernate please help me select * from ViewFabricStock VFS where VFS.REORDER_METER > VFS.VIRTUAL_STOCK VFS.REORDER_METER ,VFS.VIRTUAL_STOCK is a model property i would like also know…
user690986
  • 41
  • 2
  • 6
0
votes
1 answer

Implementing criteria for unsupported methods

I've written an application that uses LINQ to NHibernate for it's database queries. Code in my domain layer creates expressions of type System.Linq.Expressions.Expression> These are passed to repositories in my data access layer,…
Dominic
  • 481
  • 2
  • 10
0
votes
1 answer

NHibernate Criteria Month Comparison

I am trying to retrieve records based on a specific date field. My criteria is to only show records whose values do not fall within current month or greater than today's date. I already coded a criteria that is working for getting records with…
ssokol91
  • 552
  • 3
  • 13
  • 25
0
votes
1 answer

How to work with NHibernate.SqlCommand.JoinType.RightOuterJoin?

i have Project and Customer Model. Project model have Customer object with mapping.in database this may b the case where customer is exist but it not have entry in project table. i m doing CustomerSearch functionality in which user can…
Amogh
  • 4,453
  • 11
  • 45
  • 106
0
votes
2 answers

Nhibernate Expression.In limit

I am querying the Nhibernate criteria query with more then 2100 values for In clause. I do something like Session.CreateCriteria(typeof()).Add(Expression.In("fieldName",arrayValue)) Where arrayValue contains more then 2100 values. I face error…
Niraj
  • 376
  • 4
  • 14
0
votes
1 answer

queryover and is in a list filter

I dont really understand how I can perform this query using nhibernate queryover, I currently have: var users= _session.QueryOver().Future(); var comps = _session.QueryOver() .Where(x => users.Any(match =>…
Haroon
  • 3,402
  • 6
  • 43
  • 74
0
votes
1 answer

NHibernate Using a join inside a subquery: Not generating join sql statement

I have a call using QueryOver that is layed out as follows and is not generating the inner join statement needed inside the subquery. The structure of the objects that I'm querying over are as follows: public class Product { public virtual long…
Ryan Thomas
  • 479
  • 5
  • 16
0
votes
1 answer

NHibernate joins

public class Parent { public virtual long Id { get; set; } public virtual string Name { get; set; } public virtual List Children { get; set; } } public class Child { public virtual long Id { get; set; } public virtual…
0
votes
1 answer

How to build NHibernate Or criteria from two foreach?

In my project I try to buid criteria like this: ICriteria criteria = session.CreateCriteria(typeof(Orders), typeof(Orders).Name); if (param != null) { if (param[1] != "System") { for (int index = 0; index <…
Darien Fawkes
  • 3,023
  • 7
  • 24
  • 35
0
votes
1 answer

How to determine number of children of a record?

Good afternoon everyone! I'm studying NHibernate, and decided to make some changes. Among them, I noticed that some fields are unnecessary. So I bring my doubt: I have a list, let's call it Class_List within each study class, I can have N students…
Gustavo Gonçalves
  • 528
  • 1
  • 12
  • 33
0
votes
2 answers

NHibernate taking longer time executing simple query

I am facing very strange issue re NHibernate and now it is become headache. NHibernate is taking longer time (2-3 minute) than expected time (few milliseconds) to execute such a simple query. The database is Oracle and I am using ODP driver. I have…
0
votes
1 answer

NHibernate - How to write a criteria query to reflect whether a column has a null value or not

I am coding a screen which includes a list of items. Each item includes a button where the user can popup a dialog to enter or read (their previously entered) feedback on said line item. Because feedback contains a substantial amount of textual data…
JP.
  • 5,536
  • 7
  • 58
  • 100
0
votes
1 answer

How to run a function using a nhibernate criteria?

We have a search routine that uses criteria to build SQL query (because its restrictions added dynamically). In a particular case (a very complicated case) we need to search over a table-valued function.(our model object is mapped to the…
Beatles1692
  • 5,214
  • 34
  • 65
0
votes
1 answer

Retrieving data from composite table using HQL

Using NHibernate for .NET I have 3 tables. One is CourseType, the other is Contact and the last being a composite called CourseType_Contact the composite table looks like this... CourseTypeID Guid, ContactID Guid I am attempting to use HQL to write…
Maxim Gershkovich
  • 45,951
  • 44
  • 147
  • 243