I do ONLY get this error when I'm running with an IStatelessSession,
however.

When I use a normal session I don't get this error ... but I do get
another strange/unexplicable one (querying unrelated entities results
in a message about the id of some other entity changing, when I'm not
touching them! this is why I wanted to use stateless)

On Sep 29, 2:17 pm, fel0niousmonk <[email protected]> wrote:
> I'm getting a 'query did not return a unique result: x' error, where x
> is the number of rows returned.
>
> model:
> -- Customer
> --- List<TelNumber>  (mapped as: Inverse, Join)
> --- ExternalID            (db column is unique)
>
> so, when I ..
> -- session.Load(customerID)
> the sql executed looks like ..
> -- select * from customers c left join telnumbers t on .. where c.id =
> id ..
>
> which works great.
>
> HOWEVER, when I ..
> -- session.CreateCriteria<Customer>()
>               .Add(Restrictions.Eq("ExtID", externalID)
>               .UniqueResult<Customer>()
>
> the error is thrown when the customer has >= 2 telephone numbers.
> the sql generated is the same as above.
>
> I've tried putting a DistinctRootEntityTransformer in there before the
> UniqueResult .. but it doesn't help.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to