NHibernate count on unmapped entity?

The idea here would be to map this collection with a where clause.

The idea here would be to map this collection with a where clause using fluentmapping: public SomeEntityMap(){ Table("SomeTable"); HasMany(x => x. PointerRecords) . Table("PointerTable") .

KeyColumn("ThisEntityID") . Where("ObjectName = 'SomeTable'") } Begin Edit using xml-mapping End Edit and query like object results = session.CreateCriteria() . Add(Restrictions.

Eq("Id", id)) . SetProjection(Projections.ProjectionList() . Add(Projections.

Property("Field1")) ... . Add(Projections. Count("PointerRecords"))); .List() or var entities = session.CreateCriteria() .

Add(Restrictions. Eq("Id", id) . SetFetchMode("PointerRecords", NFetchMode.

Eager) .List(); entities0.PointerRecords.Count.

Thanks for your response Firo, but we are not using fluent nhibernate. – matt Jun 21 at 8:47 @matt I added the xml mapping – Firo Jun 21 at 10:10 excellent! Thanks that worked nicely.

Got the HQL working now with a PointerRecords. Size with a group by. Also added the access=�

None� Attribute so I don't have to add the collection to the entity object (although we may wish to add it anyway now that this mapping is possible). Many thanks.

– matt Jun 21 at 15:09.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions