Skip to main content
Filter by
Sorted by
Tagged with
-1 votes
1 answer
50 views

Select items from a group by where count is larger than 1

The following sample query: select * from ( select m.name, count(m.id) c from mytable m group by m.name) a where a.c > 1 How do I build that using NHibernate QueryOver? It is easy ...
Peter Larsen 'CPH''s user avatar
0 votes
1 answer
64 views

Select data from a sub-select

This is what I want to accomplish using NHibernate QueryOver: SELECT TOP 10 * from (SELECT aColumn, min(WorkingDay) as d FROM aTable GROUP BY aColumn) ...
Peter Larsen 'CPH''s user avatar
0 votes
0 answers
20 views

Nhibernate Dynamic Search With

I'm encountering an issue while working with NHibernate queries and joins. I have a scenario where I need to retrieve Holding entities based on specific conditions related to Insurance and Depot ...
husky_dusky's user avatar
1 vote
1 answer
94 views

How to convert IQueryable to "Expression<Func" to provide Projection list to NHibernate QueryOver?

Please refer to following code: using(ISession session = SessionFactory.OpenSession()) { //Case 1: using Query = works fine. IList<MasterDto> listMaster = session.Query<MasterEntity&...
PNG's user avatar
  • 113
0 votes
1 answer
184 views

nHIbernate query with conditional join

I'm trying to get an nHibernate query to work without success. Here is my data structure: public class Permission { public Guid Id {get; set;} public string Name {get; set;} } public class ...
mitti2000's user avatar
0 votes
1 answer
110 views

Conditional Queryover depending on the context

I want to do a QueryOver on an object for which I want to do an outer join on its sublist only if the current object has a property set to true. Let's say you have an object Store which has a list of ...
Ferdossi's user avatar
0 votes
1 answer
69 views

NHibernate QueryOver C#, selecting a specific property of a joined Entity to List field within a Dto

I was wondering how to do the following in QueryOver (NHibernate 4.0.4) Say I have this set of classes class Student { public virtual long Id { get; set; } public virtual IList<Exam> ...
Lazar's user avatar
  • 1
0 votes
1 answer
71 views

How to apply IQueryOver<TRoot> methods to IQueryOver?

I'm wrapping QueryOver with the interface IQueryOver. Thanks UnderlyingCriteria I can access to the criteria. I'd like to use the IQueryOver methods such as Take, Skip ... My intention is to have a ...
lunatic84's user avatar
  • 329
0 votes
1 answer
281 views

Make custom Restriction NHibernate for QueryOver

I'm stuck in a simple problem, I'd like to add a new custom restriction in NHibernate. I want to write a simple QueryOver with a fulltext index, an example with a Projections is here How to use Full ...
lunatic84's user avatar
  • 329
0 votes
1 answer
71 views

How to check if there is a person in the database who has exactly two (or more) specific addresses? (QueryOver)

I want to check if there is a person in the database who has exactly two specific addresses. My proper SQL query: SELECT name, id FROM person WHERE person.name = 'Kxxx' AND person.firstname = 'Axxx' ...
morales's user avatar
-1 votes
1 answer
132 views

Nhibernate queryover (or lambda Linq) to add count of subquery in projection

given this table TABLE A( IdA NUMERIC PRIMARY KEY ,DescA VARCHAR2(200) ) TABLE B( IdB NUMERIC PRIMARY KEY ,IdA NUMERIC ,DescB VARCHAR2(200) ) i want to select IdA , DescA , Count Of B For Each A ...
gt.guybrush's user avatar
  • 1,378
0 votes
1 answer
157 views

How to find matching pair of data in NHibernate QueryOver?

I have two lists. AccountNumbers ["account1", "account2", "account3"] Descriptions [ "desc1", "" ] (possible should be empty value) And I have two ...
Coder007's user avatar
2 votes
1 answer
232 views

could not resolve property: CS$<>8__locals2 of: BusinessObjectMain; Nhibernate QueryOver Linq, lambda expression inside a for loop

We use Vs2019 with an older version of Nhibernate 3.2. We recently upgraded to VS2019. This code worked correctly in VS2010. We are getting this error with Nibernate QueryOver, lambda expressions ...
user575219's user avatar
  • 2,414
0 votes
1 answer
261 views

NHibernate: Filter result on one-to-many join

I am trying to filter a query based on the values of all the objects on the left join. My objects are defined as such: public class Recipe { public virtual long Id {get;set;} public virtual ...
Nicolo Castro's user avatar
0 votes
1 answer
141 views

NHibernate execute the same query several times

I have stucked in executing NHibernate query several times with changing only one parameter. Here is my code if (channelCount > 1) { for (int i = 0; i < ...
hoozr's user avatar
  • 453
0 votes
1 answer
38 views

How does this NHibernate code influence the commit?

I ran into an issue where the following code results in an exception. public IList<Persoon> GetPersonenWithCurrentWorkScheme(int clientId) { //SELECT N+1 Session.QueryOver&...
Dimitris's user avatar
  • 155
0 votes
1 answer
526 views

Nhibernate queryover union

I have two queries based in session.QueryOver. The queries are different, but returns a IList the same type object. The number of result of the two query, is the total object that i need. How can I ...
MariPaz Coloma's user avatar
1 vote
1 answer
1k views

NHibernate QueryOver with SelectList

I have multiple queries against one table. As not all columns/properties are needed I specify the columns with the help of select list. Take the following method as example. This method is working ...
AFrueh's user avatar
  • 45
2 votes
0 answers
105 views

Is it possible to order a query based on a NHibernate multi-column user type, preferably via QueryOver?

I have a fluent mapped a database table that uses two columns to represent an IP Address. One column, a string discriminator, address_family represents the address family (IPv4 vs IPv6) and a second ...
rheone's user avatar
  • 1,547
1 vote
1 answer
375 views

How to split a string field and check if it contains a specified string using an nhibernate queryOver?

I am trying to use NHibernate QueryOver to return results where a column (DoNotDisplay) with a comma separated string does not contain a specific string e.g. "3". I have tried the following: var ...
ma268's user avatar
  • 57
0 votes
1 answer
135 views

Problems migrating from VS2010 to VS2017 on NHibernate QueryOver

Since we have migrated our solutions from VS2010 to VS2017 a lambda expression of NHibernate QueryOver is not working properly. After various tests I've found that removing a JoinAlias (but removing ...
Marc's user avatar
  • 1,445
0 votes
1 answer
96 views

NHibernate QueryOver and selecting rows where a propery is an ILIST and the list count >= 1

I would like to select rows for which the property Items which is an IList has rows itself. In SQL its easy count >= 1 but in NHibernate it eludes me. Tried many ways public class Sale { private ...
Luis Vargas's user avatar
0 votes
1 answer
822 views

NHibernate QueryOver Where Or on property and nested collection

I have classes Foo and Bar class Foo { string Name; IList<Bar> Bars; } class Bar { string Name; } I have an input q and I want to write an NHibernate query that returns a list of ...
LIvanov's user avatar
  • 1,214
1 vote
1 answer
312 views

NHibernate QueryOver - Doing Fetches and OrderBy -> What Syntax to use?

All, I have a query as such: _AddOrderBy(sortOptions, query) .Fetch(x => x.ImageType).Eager .Fetch(x => x.User).Eager .Fetch(x => x.Partner)....
ActiveX's user avatar
  • 1,067
3 votes
1 answer
1k views

NHibernate multiple subqueries with in clause

I have a following working SQL query: SELECT * FROM truck t WHERE t.currentlocationdbid IN (SELECT dbid FROM location WHERE name = 'Los Angeles') OR t.nextdestinationdbid IN (SELECT dbid FROM ...
dzookatz's user avatar
  • 213
0 votes
1 answer
283 views

Nhibernate 3.0 IQueryOver group by and fetch one entire record in each group which satisfy the condition

My requirement is to fetch the SiteItemOnHand records, group by Businessunitid,inventoryitemid and get the whole SiteItemOnHand record in each group which is having max(lastmodifiedtimestamp) I am ...
Chandra Mohan's user avatar
3 votes
1 answer
2k views

NHibernate + QueryOver: How to join unmapped entity by ID?

given is the table A with columns EntityType (Enum that specifies either Entity/Table of type B or Entity/Table of type C) and EntityID (ID of an entry in table B or table C). Both classes B and C ...
Powerslave's user avatar
1 vote
2 answers
935 views

NHibernate query over projection

I have two entities A and B where A has one-to-many relationship with B. I would like to create an NHibernate query that fetches all A entities with all the B records, where: the A entity is active ...
LIvanov's user avatar
  • 1,214
0 votes
1 answer
433 views

Variable of type referenced from scope, but it is not defined. Error to compare string in QueryOver

Yeah, I know that there are many questions of this subject open and answered in stackoverflow, but none solved my problem. I'm trying to compare two strings in where clause of QueryOver, but I had ...
Vinícius da Cruz Maia's user avatar
-1 votes
1 answer
348 views

NHibernate QueryOver condition on several properties

I have this armor table, that has three fields to identify individual designs: make, model and version. I have to implement a search feature for our software, that lets a user search armors ...
Jean-David Lanz's user avatar
1 vote
1 answer
420 views

Selecting referenced entity instead of root entity in NHibernate, ordered by usage count

I have the following two object models: public class Product { public int IdProduct; public Category IdCategory; public string Name; public bool Available; } public class Category { ...
brz's user avatar
  • 1,949
0 votes
2 answers
49 views

"Search engine" for classes

I am trying to figure out a way to make it possible for users to search for a specific text or value in all parts of the domain. For instance, I have these simplified classes: public class Person { ...
TedOnTheNet's user avatar
  • 1,102
0 votes
1 answer
521 views

NHIbernate: Get children object filtered by parent object's property

I use Fluent NHibernate to map my entities. My classes: public class Email { public virtual int Id { get; protected set; } public virtual string Status { get; set; } public ...
Mozgalev Vladislav's user avatar
0 votes
1 answer
480 views

Nhibernate SQLQuery as Subquery

How Can use a native sqlquery (session.CreateSqlQuery) as filtering subquery in another QueryOver: // Get ids var idsq = _session.CreateSQLQuery( "select ...
Baloo0ch's user avatar
0 votes
1 answer
909 views

Saving and querying elements in Nhibernate

I have two very simple classes, one is Store class which is coded as follows Store class Store { public virtual int StoreID { get; set; } public virtual string Name { get; set; } public ...
a.ras2002's user avatar
  • 385
2 votes
1 answer
2k views

Nhibernate QueryOver how can I make this query use async?

For this new website I want to use async methods in NHibernate. I have this simple query using QueryOver API but I can't get this one to work with async. It is a simple query with some where clauses ...
Nanou Ponette's user avatar
0 votes
1 answer
482 views

Getting referenced values with NHibernate

I have the following entities Item virtual public int serialNumber { get; set; } virtual public Project idProject { get; set; } virtual public string type{ get; set; } Project virtual public int ...
a.ras2002's user avatar
  • 385
0 votes
1 answer
1k views

nhibernate join on subquery

I am trying to do a join on a subquery to another table I have the following entity: public class SomeClass { public virtual string KeyPart1 { get; set; } public virtual string KeyPart2 { get;...
Nico Pizzo's user avatar
1 vote
1 answer
1k views

nhibernate QueryOver select one table after join

So I am having issues selecting just the Parent entities as this will also return the Child entities. Currently I have the following entities: public class Parent { public virtual string KeyPart1 ...
Nico Pizzo's user avatar
1 vote
1 answer
108 views

Problems implementing ordering and paging in NHibernate's QueryOver API for queries using joins and projections

I'm still trying to get the hang of NHibernate. I'm doing some queries with projections, and so far I managed to come up with this: var restrictions = Restrictions.Conjunction(); // add some ...
Fernando Gómez's user avatar
0 votes
1 answer
222 views

SQL to NHibernate queryover with SQL function Values

I am trying to make a queryover that returns a list of objects called StatusTaxatieAantal. public class StatusTaxatieAantal { public long Aantal { get; set; } public long StatusTaxatie { ...
louisschrauwen's user avatar
0 votes
1 answer
70 views

QueryOver Nhibernate where sum is Greater

Select * from TableA a where a.AmountA + a.AmountB > 1 I am trying to do the above with the QueryOvery API. I have already tried QueryOver<TableA>().Where(x => x.AmountA + x.AmountB ...
user3397856's user avatar
2 votes
1 answer
1k views

Fluent NHibernate dynamic DTO query

I'm trying to write a dynamic query using Fluent NHibernate and struggling to work out how to apply the dynamic where criteria. This is for an ASP.NET MVC5 project, where I wish to display a table of ...
Chris Pickford's user avatar
1 vote
1 answer
305 views

Calling an object constructor from NHibernate QueryOver SelectList

I have a DTo class UserDTO with the following constructor public UserDTO(User user). I have also created an NHibernate query which retrieves a IList<TodoDTO> where each TodoDTO has the following ...
Bunnynut's user avatar
  • 1,328
0 votes
0 answers
42 views

How to efficiently search records and get parent records with NHibernate QueryOver

I am building a platform where webshops can create their own shop. Each shop has their own set of Productcategory and relations (CategoryProductX) to Product records. So Product records can have a ...
Bunnynut's user avatar
  • 1,328
1 vote
1 answer
1k views

NHibernate Like restriction on nested string properties

For simplicity, let's guess there are two entities: public class Entity { public string Value { get; set; } public ChildEntity Child { get; set; } } public class ChildEntity { public ...
Yeldar Kurmangaliyev's user avatar
0 votes
2 answers
178 views

Get Count from IQueryOver without loading rows from DB

Having IQueryOver, How I can get the row count from it, without loading all rows from DB? QueryOver has RowCount() method, but if the underlying query has group-by or distinct, it discards them. *****...
Saeed's user avatar
  • 195
0 votes
1 answer
646 views

How to set multiple connection string in Nhibernate and how to maintain multiple sessions under single sessionFactory

I want to use two connection strings of two different sql database but my problem is nhibernate allows one connection string for one session under one sessionFactory. If I want to use second ...
Ankush Band's user avatar
3 votes
2 answers
1k views

NHibernate Query to json results are unexpected

I'm building a webapplication with .Net Core using web api, angular 2 and NHibernate. I have the following tables in my database: Todo ID Name Priority Priority ID Name And the following mapping ...
Bunnynut's user avatar
  • 1,328
0 votes
1 answer
110 views

Query over throws exception

I tried this query over criteria: Area area = null var res = session.QueryOver<Area>(() => area); res.UnderlyingCriteria.Add(Expression.Where<Area>(x => x.shops.where(s => s.Id =...
Itay Golan's user avatar

1
2 3 4 5
15