[nhusers] Aggregate Root and Nhibernate Identifiers

2010-12-01 Thread Andyk
Hi, Im currently working on a code base that avoids Repository.Add() as much as possible. Instead, we use an aggregate root along with cascade all mapping. (eg: to add something, we simply do customer.Orders.Add(...)) We're also using sequential guids generated in the code. The problem Ive noticed

[nhusers] Retrieving many to many objects

2009-12-14 Thread Andyk
I have a domain object called Product, that has a many to many collection of type Category. I want to retrieve just the categories that belong to a specific Product. var result = Session.CreateCriteria() .Add(Restrictions.Eq("Name", "Television")) .CreateCriteria("C

[nhusers] Re: Nhibernate, WCF and SessionContext

2009-11-16 Thread Andyk
Thanks Fabio and Donald. It was quite an insight realising that Wcf doesnt (by default) generate a context per call. Explains alot of our problems. Thanks for the help. Andy On 13 Nov, 23:28, Fabio Maulo wrote: > ah... > and don't forget to configure NH > >         >            uNhAddIns.Ses

[nhusers] Re: Nhibernate, WCF and SessionContext

2009-11-12 Thread Andyk
text.Bind(session); >           item(); >           tx.Commit(); >           CurrentSessionContext.Unbind(factory); >      } > > }); > > On Nov 12, 12:36 pm, Andyk wrote: > > > > > Hi, > > can anyone tell me which sessioncontext should be used in a Wcf > > e

[nhusers] Nhibernate, WCF and SessionContext

2009-11-12 Thread Andyk
Hi, can anyone tell me which sessioncontext should be used in a Wcf environment. Currently I have a web application calling a WCF service, hosted in IIS. The WCF service does all the work and uses NHibernate. I am using sessioncontext in a static class to manage nhibernate session like this:

[nhusers] Re: unindexed collection issue in complex hql query

2009-06-15 Thread Andyk
Here are the mappings: I removed the irrelevant properties for clarity. Wolfgang, that didnt

[nhusers] unindexed collection issue in complex hql query

2009-06-15 Thread Andyk
Hi all, Im working on a Cuyahoga project and having some issues trying to write a complex hql query and was wondering if anyone could help. I have a domain that contains Nodes. Nodes have Sections which contain Articles. Nodes also have ChildNodes. I'm trying to retrieve all Articles within a Nod

[nhusers] Calling a stored proc with parameters

2009-05-20 Thread Andyk
Hi all, I need to call a stored procedure and Im using the following code to do it: session.CreateSqlQuery("exec proc_GetFunds").AddEntity(typeof(Fund)); (Not sure if this is the right way or not?) The problem is, that I need to provide several paramters such as a currency Id and two date period

[nhusers] Re: LazyInitializationException Issue

2009-04-28 Thread Andyk
collection to not be lazy loaded. regards Andy On 27 Apr, 22:30, Andyk wrote: > Hi, > could anyone kindly spot the obvious, Im getting a "Failed to > initialise" exception on my code and I cant see why. > >         [Test] >         public void Should_be_abl

[nhusers] LazyInitializationException Issue

2009-04-27 Thread Andyk
Hi, could anyone kindly spot the obvious, Im getting a "Failed to initialise" exception on my code and I cant see why. [Test] public void Should_be_able_to_insert_a_child_category() { string parentName = "Electronics"; string childName = "Televisio

[nhusers] Transforming data

2009-02-25 Thread Andyk
Hi, Im looking for some advise on how to go about presenting some report data. In my scenario, I have the following Sales object: SalesId Customer SalesType Amount I want to be able to produce a report, a row for each customer, with the different salesTypes as columns, and Amount values in the mi