Questions tagged [nhibernate-projections]
83 questions
0
votes
1 answer
Help with group by clause in projection queries
I want to group records of people coming in on any airport per day per hour. So basically I want a count of people coming in everyhour at any particular airport. Below is my code for it.
string ArrDate =
…

developer
- 5,178
- 11
- 47
- 72
0
votes
1 answer
NHibernate Projection queries
I want to get a count of different Designation of Persons from a table. For Eg, 5 managers, 2 HR, 3 coordinates,etc. The below query gives me a total count of entries in UserDesig field. I want to have total count of different designations in the…

developer
- 5,178
- 11
- 47
- 72
0
votes
1 answer
Help with NHibernate query
I have 2 tables, Plan and Ticket. I want all the records that are in TravelPlan but not in Ticket.
Template.Criteria.CreateCriteria("Plan")
.Add(Subqueries.PropertyNotIn("UserID",
…

developer
- 5,178
- 11
- 47
- 72
0
votes
1 answer
Nested collection using Criteria: How to retrieve table1.getTable2().get(0) using criteria
I have 2 tables TABLE1 and TABLE2.
hibernate class of TABLE1
class Table1
{
private Collection< table2s> table2s= new ArrayList< table2s>();
}
Now using criteria I need to fetch Table1 records and the results should have Table2s one records among…

Shashank V C
- 153
- 1
- 1
- 9
0
votes
1 answer
How to build a query using Hibernate Criteria and Projections
I want to build a query like below using Hibernate Projections attribute. Can someone check the below. I have written java code like.
DetachedCriteria dCriteria = DetachedCriteria.forClass(FinancialYearQuater.class, "FinancialYearQuater");
…

Vimal Panchal
- 301
- 1
- 5
- 15
0
votes
1 answer
How to add multiple columns inside a single GroupProperty method of Nhibernate Projections Class
I am using Visual Studio 2008. I am trying add multiple columns inside a single
GroupProperty method of Nhibernate.Projections Class. But But I am failing to get the required output. I tried something like this.
ICriteria Criteria =…

DeepakTheGeek
- 123
- 3
- 15
0
votes
1 answer
NHibernate - Querying from a collection of Value Types (non-Entity) to solve Select N+1
I have an entity that represents a Tweet from Twitter like so:
public class Tweet
{
public virtual long Id { get; set; }
public virtual string Username { get; set; }
public virtual string Message { get; set; }
// other properties…

Sunday Ironfoot
- 12,840
- 15
- 75
- 91
0
votes
1 answer
NHibernate: how to express a specific "group by" query with criteria
Question:
What are the criteria/projections that can generate a following query?
SELECT SUBSTRING(Name, 0, 1) FROM Person GROUP BY SUBSTRING(Name, 0, 1)
(Obviously this one is easier with DISTINCT, but I'll need counts later, when I fix this one). …

Andrey Shchekin
- 21,101
- 19
- 94
- 162
0
votes
1 answer
Fetch data by applying where clause on list which contains premitive data type elements in Hibernate
I have hibernate mapping like shared bellow

Navnath
- 1,064
- 4
- 18
- 34
0
votes
1 answer
NHibernate LINQ projection using helper class
I'm trying to add projection to an NHibernate LINQ query (via .select()), but since I have a bit of logic I want to use a helper class rather than returning a projected model directly.
My code looks like this (shortened):
var query =…

MarioDS
- 12,895
- 15
- 65
- 121
0
votes
0 answers
Grails Criteria distinct doesn't work
In my app I use createCriteria for getting a list according some criteria.
roleMapping contains user.
I use the following code:
def getTeamOfCompany(def company,def offset=0){
def c = roleMapping.createCriteria()
def result =…

Sarit Sara
- 101
- 2
- 13
0
votes
1 answer
Nhibernate queryover filter based on count of child collection
Ultimately I want to filter all parent objects that have less than 2 children.
I'm building a search screen with a grid dashboard, which uses the following logic as a example of how to build a query.
var query = Session.QueryOver(() =>…

Seth
- 954
- 1
- 15
- 42
0
votes
2 answers
NHibernate Projections failure
I have tag class which have relation many-to-many with article class, The problem is I want to make a projection which represent in tag view model class so the column result should be like this…

Dion Dirza
- 2,575
- 2
- 17
- 21
0
votes
1 answer
NHibernate: how to return root type object in SelectList
My DTO:
public class ServiceWithCount
{
public Service Service { get; set; }
public long Count { get; set; }
}
and:
public class Service
{
public virtual long Id { get; set; }
...
}
public class Vote
{
public virtual long Id { get; set;…

tjedrzejczak
- 3
- 1
0
votes
1 answer
nhibernate query, selecting only specific fields
i have these entities:
ClassB1 and ClassB2 are two separate entities. They have separate tables but the same fields.
Both of them have reference to ClassC which has a separate table.
ClassA
-> ClassB1
-> Property1
-> ClassC
…

raberana
- 11,739
- 18
- 69
- 95