Questions tagged [nhibernate-projections]

83 questions
1
vote
0 answers

Hibernate lazy property with projections

If you have your bean MyClass with a lot of properties. If you want to lazy get one property with @Basic( fetch=lazy) you need to instrument your class right? but what if you do a projection over your bean and then do a…
ics_mauricio
  • 369
  • 3
  • 16
1
vote
0 answers

How to Use hibernate Projections Without the Deprecated method Create Criteria. Is there any other ways use Projections without deprecated method

Actually I have used Hibernate projections in the below code to sum multiple columns. I may send any number of column but the query will be generated according the number of column. *** The problem here is I have use an deprecated method *** I need…
Santil
  • 124
  • 1
  • 4
1
vote
1 answer

How to build string query with NHibernate?

I would like to reproduce this query with NHibernate using projection SELECT ('reword#' || reword) || reword_faq as foo FROM me_review_entries re WHERE ('reword#' || reword) || reword_faq = 'reword#2#SOME_FAQ' I…
Baptiste Pernet
  • 3,318
  • 22
  • 47
1
vote
1 answer

Help with conditional projection queries

I have a requirement wherein I need to display a list of employees and their roles. So if the role of the employee is Accounting, I want to display FirstName and LastName of that employee. Below is my code for it SearchTemplate RoleTemplate = new…
appuser
  • 269
  • 1
  • 3
  • 10
1
vote
1 answer

Sum of data for current week using projection queries

I want to do a total of fields in database for the current week. For eg, If today is wednesday, I want to do a total of current Monday through Wednesday, if its Thursday then Monday through Thursday.. How will I do this using projection queries in…
appuser
  • 269
  • 1
  • 3
  • 10
1
vote
1 answer

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 { public int IdCategory; public string…
brz
  • 1,846
  • 21
  • 21
1
vote
1 answer

The name 'NHibernateUtil' does not exist in the current context

Below projection query throws " The name 'NHibernateUtil' does not exist in the current context" error when I try to run the app. I tried including namespace NHibernate.Util but it still wont work. Any help would be appreciated. …
developer
  • 5,178
  • 11
  • 47
  • 72
1
vote
1 answer

NHibernate select complex sum

I have an entity: class Entity { public int A { get; set; } public int B { get; set; } public int C { get; set; } } I want to select sum of (A-B-C). So I want to run sql like this: SELECT SUM(A-B-C) FROM…
Roman Koliada
  • 4,286
  • 2
  • 30
  • 59
1
vote
1 answer

Hibernate one to many returning multipe duplicate objects

I have a one to many relation entities Scenario is like this EmployeeGroupActivity has Many EmployeeActivity Hibernate Mapping is done as follows @Entity @Table(name = “employeegroupactivity”) @DynamicUpdate public class EmployeeGroupActivity{ …
Sadanand
  • 1,080
  • 3
  • 13
  • 30
1
vote
1 answer

NHibernate: ProjectionList: Can we create dynamic projectionlist for Orderby

I am working on a query in NHibernate in which user could provide a sorting order for some selected fields. I need to do a OrderBy() in QueryOver with the names of field names in entities, but when using projection list I am getting like…
Builder
  • 1,046
  • 2
  • 10
  • 30
1
vote
1 answer

nHibernate - Dynamic projection list, need to return constant text

How can I return constant text in projection list, Not sure if I am doing it right or not. projectionList.Add(Projections.Property("This Year Issue Price").WithAlias(() => sProduct.PriceTitle)); This way I assume that I will get "This Year Issue…
Builder
  • 1,046
  • 2
  • 10
  • 30
1
vote
1 answer

Join collection in QueryOver with projections

I want to retrieve the list of short User versions with their Characters collection (short version too). I use QueryOver with projections. public class User { public virtual int Id { get; set; } public virtual string Nickname { get;…
Vlad
  • 3,001
  • 1
  • 22
  • 52
1
vote
1 answer

Make Projection on discriminator-value

I have this NHibernate mapping ... ...
Makich
  • 107
  • 1
  • 8
1
vote
1 answer

How to project the Collections in NHibernate?

Is it possible to project the collections in NHibernate? For Example: User { UserGuid, IList UserGroups, } User userEntity = null; _session .StatefulSession.QueryOver(() => userEntity) …
TTT
  • 183
  • 1
  • 10
1
vote
1 answer

hibernate criteria set projection groovy

I am using groovy: this works well but I need it to have a field mapping coz it returns [[1,2], [2,2]]. I need it to be like this [[caseId :1, countId: 2], [caseId :2, countId: 2]] def childNotes = ChildNote.withCriteria() { …