Questions tagged [nhibernate-projections]

83 questions
3
votes
0 answers

Nhibernate projection with alias to nested property

I have a DTO class like this: public class Aggregates { public Aggregates() { Sales = new StatisticAggregates(); Refund = new StatisticAggregates(); } public int ChecksAmount { get; set; } public…
2
votes
2 answers

LINQ-to-NHibernate: Cannot use Linq Skip() and Take() with FetchMany

I have these entities: public class BlogPost { public virtual int Id { get; set; } public virtual IList Keywords { get; set; } public virtual IList Comments { get; set; } } public class BlogComment { public…
2
votes
2 answers

NHibernate QueryOver, Projections and Aliases

I have an nhibernate issue where I am projecting the sql Coalesce function. I am comparing two string properties having the same name, from two different entities. In the resulting sql, the same property from only the first entity is being compared…
jenson-button-event
  • 18,101
  • 11
  • 89
  • 155
2
votes
1 answer

NHibernate - Projections.Property on detached criteria with Alias

I am building a semi-complex report query (may not be the best way, but it works fine up until this issue). // total appointments var appts = DetachedCriteria.For("appt") .CreateAlias("Lead", "lead") …
Paul Hinett
  • 1,951
  • 2
  • 26
  • 40
2
votes
1 answer

Nhibernate projection with child collection

Using NHibernate 2.1, I'm trying to project an entity and its child collection into a DTO. My entity looks like this.. public class Application { public int Id {get;set;} public string Name {get;set;} public List Settings…
Rob Gibbens
  • 1,122
  • 1
  • 8
  • 24
2
votes
1 answer

Best practices with interface projections for JPA Repository in Spring?

I was wondering if anyone can give feedback on a pattern that I am currently playing around with? It involves having an entity implementing a DTO interface that is also used (as a projection) in a JpaRepository interface – for the same entity – to…
Andy Tang
  • 51
  • 2
  • 7
2
votes
1 answer

How to do this in nhibernate queryover

I need to do this in nhibernate QueryOver: select distinct sc.* from [Security].[Commands] sc inner join [Security].[SystemSubjects] ss on ss.Id = sc.Id left outer join [Security].[SystemSubjectRoles] ssr on ssr.SystemSubjectId = ss.Id left outer…
Luka
  • 4,075
  • 3
  • 35
  • 61
2
votes
1 answer

Help with NHibernate Criteria query groupby property

I have the below query, SearchTemplate Template = new SearchTemplate(); Template.Criteria = DetachedCriteria.For(typeof(table1)); Template.Criteria.CreateCriteria("table2", "Usr", NHibernate.SqlCommand.JoinType.InnerJoin) …
developer
  • 5,178
  • 11
  • 47
  • 72
2
votes
1 answer

Hibernate Many-to-Many Criteria Projection

EDIT> i am at a dead end... so i can continue looking for the main reason .. Please tell me how to make a simple criteria for many to many relationships which has more than one eq restrictions, for an example, how to get the person speaking eng &…
2
votes
1 answer

Fluent NHibernate - ProjectionList - ICriteria is returning null values

I'm quite new in NHibernate, but I have googled around and didn't found anything to help with this issue. I hope you guys can ! ;) I'm changing names of properties, and methods, because this code is company's property but basically this is what I…
2
votes
1 answer

NHibernate: no persister for CastProjection

Let's say I had a database with a table of academic papers, and there was a column which indicated whether the paper was published in a "major" journal (as a bit). I might want to run a query to list every author and whether they'd ever been…
phil
  • 33
  • 2
2
votes
1 answer

Using in-built sql "Convert" function in nhibernate criteria

I want to make use of the Convert function in SQL Server 2008 so I can search on a DateTime column. The proposed SQL would look something like this: SELECT (list of fields) FROM aTable WHERE CONVERT(VARCHAR(25), theColumn) LIKE '%2009%' Here is…
2
votes
1 answer

Usage of NHibernate Interceptor(s) on Projections

I have this situation: I'm using Nhibernate to map an Entity 'User' that is mapped on a large table in Sql, for perfomance reasons I've created a lightweight entity 'LightweightUser' that has only a small set of properties and is NOT mapped in a hbm…
1
vote
1 answer

NHibernate QueryOver Projection with combined property output..Is there any way?

I'm using NHibernate 3.2 and I'm trying to create a projection with two columns mapped to a string to build out full name. var user = Session.QueryOver() .Select(u => u.FirstName + " " + u.LastName) …
Kevin Jensen
  • 1,418
  • 3
  • 18
  • 25
1
vote
3 answers

cannot project entities in Linq 2 NHibernate

I'm working with NHibernate 2 in a .Net project and I'm using the Linq2NHibernate provider. This simple query var result = from d in session.Linq() where d.CreationYear == 2010 select d.ChildEntity).ToList(); throws an exception telling…
themarcuz
  • 2,573
  • 6
  • 36
  • 53