RE: [nhusers] Re: Linq Provider

2016-01-22 Thread Jon Miller
OK, so, where is the LINQ documentation? I’m assuming you must mean LINQ itself 
and not the NHibernate provider for it. The least someone could do is add a 
line to the detailed documentation saying that all you need to do is add a 
“using NHibernate.Linq” to get it to work. The only thing that is mentioned in 
the detailed documentation is QueryOver. I don’t even see a link to a zip for 
the source that matches the last release version.

Jon

From: nhusers@googlegroups.com [mailto:nhusers@googlegroups.com] On Behalf Of 
Oskar Berggren
Sent: Friday, January 22, 2016 5:20 AM
To: nhusers@googlegroups.com
Subject: Re: [nhusers] Re: Linq Provider

Haha, reviving a thead from four and a half years ago just to rant for a bit.  
:)
That being said, sure there could certainly be more documenation. With regards 
to the LINQ provider a lot has happened since 2011, in the last couple of 
releases my experience is that many more queries "just work". And LINQ itself 
is documented elsewhere.
/Oskar

2016-01-22 4:58 GMT+00:00 <jemil...@uchicago.edu<mailto:jemil...@uchicago.edu>>:
As far as I can tell, the only documentation ever written for NHibernate since 
JBoss ditched it is the Getting Started Guide. It's pretty pathetic that LINQ 
isn't even mentioned in the detailed documentation. Most of the documentation 
looks like it came from Java Hibernate. There used to be a CHM file about 6+ 
years ago for the API documentation. That seemed to disappear and it seemed to 
not be a priority for anyone to put it back.

On Tuesday, August 9, 2011 at 5:28:02 AM UTC-5, Michael Delaney wrote:
Is there a page somewhere, some documentation etc that outlines what is and 
what is not supported in the Linq To NHibernate provider???

it seems that lots of stuff is not supported, left outer joins, group by 
clauses etc??

its frustrating having to come across this on a trial and error basis..
--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
nhusers+unsubscr...@googlegroups.com<mailto:nhusers+unsubscr...@googlegroups.com>.
To post to this group, send email to 
nhusers@googlegroups.com<mailto:nhusers@googlegroups.com>.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google 
Groups "nhusers" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/nhusers/W293jf1ww-Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
nhusers+unsubscr...@googlegroups.com<mailto:nhusers+unsubscr...@googlegroups.com>.
To post to this group, send email to 
nhusers@googlegroups.com<mailto:nhusers@googlegroups.com>.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.


[nhusers] Re: Linq Provider

2016-01-22 Thread jemiller
As far as I can tell, the only documentation ever written for NHibernate 
since JBoss ditched it is the Getting Started Guide. It's pretty pathetic 
that LINQ isn't even mentioned in the detailed documentation. Most of the 
documentation looks like it came from Java Hibernate. There used to be a 
CHM file about 6+ years ago for the API documentation. That seemed to 
disappear and it seemed to not be a priority for anyone to put it back.

On Tuesday, August 9, 2011 at 5:28:02 AM UTC-5, Michael Delaney wrote:
>
> Is there a page somewhere, some documentation etc that outlines what is 
> and what is not supported in the Linq To NHibernate provider???
>
> it seems that lots of stuff is not supported, left outer joins, group by 
> clauses etc??
>
> its frustrating having to come across this on a trial and error basis..
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.


Re: [nhusers] Re: Linq Provider

2016-01-22 Thread Ricardo Peres
I guess the key here is what we already know - we have a lousy 
documentation. And it's everyone's fault... :-(

RP

On Friday, January 22, 2016 at 11:20:00 AM UTC, Oskar Berggren wrote:
>
> Haha, reviving a thead from four and a half years ago just to rant for a 
> bit.  :)
>
> That being said, sure there could certainly be more documenation. With 
> regards to the LINQ provider a lot has happened since 2011, in the last 
> couple of releases my experience is that many more queries "just work". And 
> LINQ itself is documented elsewhere.
>
> /Oskar
>
>
> 2016-01-22 4:58 GMT+00:00 :
>
>> As far as I can tell, the only documentation ever written for NHibernate 
>> since JBoss ditched it is the Getting Started Guide. It's pretty pathetic 
>> that LINQ isn't even mentioned in the detailed documentation. Most of the 
>> documentation looks like it came from Java Hibernate. There used to be a 
>> CHM file about 6+ years ago for the API documentation. That seemed to 
>> disappear and it seemed to not be a priority for anyone to put it back.
>>
>> On Tuesday, August 9, 2011 at 5:28:02 AM UTC-5, Michael Delaney wrote:
>>>
>>> Is there a page somewhere, some documentation etc that outlines what is 
>>> and what is not supported in the Linq To NHibernate provider???
>>>
>>> it seems that lots of stuff is not supported, left outer joins, group by 
>>> clauses etc??
>>>
>>> its frustrating having to come across this on a trial and error basis..
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "nhusers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to nhusers+u...@googlegroups.com .
>> To post to this group, send email to nhu...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/nhusers.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.


Re: [nhusers] Re: Linq Provider

2016-01-22 Thread Oskar Berggren
Haha, reviving a thead from four and a half years ago just to rant for a
bit.  :)

That being said, sure there could certainly be more documenation. With
regards to the LINQ provider a lot has happened since 2011, in the last
couple of releases my experience is that many more queries "just work". And
LINQ itself is documented elsewhere.

/Oskar


2016-01-22 4:58 GMT+00:00 :

> As far as I can tell, the only documentation ever written for NHibernate
> since JBoss ditched it is the Getting Started Guide. It's pretty pathetic
> that LINQ isn't even mentioned in the detailed documentation. Most of the
> documentation looks like it came from Java Hibernate. There used to be a
> CHM file about 6+ years ago for the API documentation. That seemed to
> disappear and it seemed to not be a priority for anyone to put it back.
>
> On Tuesday, August 9, 2011 at 5:28:02 AM UTC-5, Michael Delaney wrote:
>>
>> Is there a page somewhere, some documentation etc that outlines what is
>> and what is not supported in the Linq To NHibernate provider???
>>
>> it seems that lots of stuff is not supported, left outer joins, group by
>> clauses etc??
>>
>> its frustrating having to come across this on a trial and error basis..
>>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nhusers+unsubscr...@googlegroups.com.
> To post to this group, send email to nhusers@googlegroups.com.
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.


RE: [nhusers] Re: Linq Provider

2016-01-22 Thread Oskar Berggren
A simple chapter in the reference doc would be great. The source zip is on
sourceforge, maybe we should provide links to the directory there, in
addition to the main binary. Though if you want the source for most uses it
would be best to fork on github, to make it easier to update.

Both doc and web can be updated with github pull requests. If anyone wants
to submit an update here or there, it would be great.

/Oskar
Den 22 jan. 2016 4:25 em skrev "Jon Miller" <jemil...@uchicago.edu>:

> OK, so, where is the LINQ documentation? I’m assuming you must mean LINQ
> itself and not the NHibernate provider for it. The least someone could do
> is add a line to the detailed documentation saying that all you need to do
> is add a “using NHibernate.Linq” to get it to work. The only thing that is
> mentioned in the detailed documentation is QueryOver. I don’t even see a
> link to a zip for the source that matches the last release version.
>
>
>
> Jon
>
>
>
> *From:* nhusers@googlegroups.com [mailto:nhusers@googlegroups.com] *On
> Behalf Of *Oskar Berggren
> *Sent:* Friday, January 22, 2016 5:20 AM
> *To:* nhusers@googlegroups.com
> *Subject:* Re: [nhusers] Re: Linq Provider
>
>
>
> Haha, reviving a thead from four and a half years ago just to rant for a
> bit.  :)
>
> That being said, sure there could certainly be more documenation. With
> regards to the LINQ provider a lot has happened since 2011, in the last
> couple of releases my experience is that many more queries "just work". And
> LINQ itself is documented elsewhere.
>
> /Oskar
>
>
>
> 2016-01-22 4:58 GMT+00:00 <jemil...@uchicago.edu>:
>
> As far as I can tell, the only documentation ever written for NHibernate
> since JBoss ditched it is the Getting Started Guide. It's pretty pathetic
> that LINQ isn't even mentioned in the detailed documentation. Most of the
> documentation looks like it came from Java Hibernate. There used to be a
> CHM file about 6+ years ago for the API documentation. That seemed to
> disappear and it seemed to not be a priority for anyone to put it back.
>
> On Tuesday, August 9, 2011 at 5:28:02 AM UTC-5, Michael Delaney wrote:
>
> Is there a page somewhere, some documentation etc that outlines what is
> and what is not supported in the Linq To NHibernate provider???
>
>
>
> it seems that lots of stuff is not supported, left outer joins, group by
> clauses etc??
>
>
>
> its frustrating having to come across this on a trial and error basis..
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nhusers+unsubscr...@googlegroups.com.
> To post to this group, send email to nhusers@googlegroups.com.
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "nhusers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nhusers/W293jf1ww-Y/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> nhusers+unsubscr...@googlegroups.com.
> To post to this group, send email to nhusers@googlegroups.com.
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nhusers+unsubscr...@googlegroups.com.
> To post to this group, send email to nhusers@googlegroups.com.
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhusers+unsubscr...@googlegroups.com.
To post to this group, send email to nhusers@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.


[nhusers] Re: Linq Provider

2011-08-09 Thread Fabio Maulo
If you want you can check our test suit to very which clauses are tested.

-- 
You received this message because you are subscribed to the Google Groups 
nhusers group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/KfgRNCGJNKAJ.
To post to this group, send email to nhusers@googlegroups.com.
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.



[nhusers] Re: LINQ Provider: Sum When There Are No Elements

2011-04-15 Thread Ricardo Peres
Vahid, you're THE man! It worked! I didn't know this technique.
Thanks!

RP

On Apr 14, 5:16 pm, Vahid vahid.nas...@gmail.com wrote:
 In my post Value is not a nullable type. So you saw that casting.

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



[nhusers] Re: LINQ Provider: Sum When There Are No Elements

2011-04-14 Thread Ricardo Peres
Found an old thread about the same problem:
http://groups.google.com/group/nhusers/browse_thread/thread/cb2d05d9d3e57b6b/f5a1e0586c17dac7
and a JIRA ticket: http://216.121.112.228/browse/NHLQ-8.

On Apr 14, 12:50 pm, Ricardo Peres rjpe...@gmail.com wrote:
 Hello,

 How can I do a sum using a LINQ query when the query produces no
 elements?

 Int32 sum = (from a in session.QueryAnalogicalValue() select
 a.Value).Sum();

 This fails with a NullReferenceException. The DefaultIfEmpty operator
 could probably solve this, but it is not yet implemented.
 Does any of you guys have a solution? Shall I add a JIRA issue for
 implementing the DefaultIfEmpty operator?

 Thanks!

 RP

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



[nhusers] Re: LINQ Provider: Sum When There Are No Elements

2011-04-14 Thread Vahid
Hello,
This is the definition of Sum method here:
public static ***TResult*** SumTSource(
this IQueryableTSource source,
ExpressionFuncTSource, ***TResult*** selector)

As you can see TResult defines the return type of the method based
on the result of the applying a lambda-expression which is TResult
too.
Now try queries like this : (the same rule applies to EF and LINQ to
SQL)
var sum = Where(t=...)
.Sum(t=(decimal?)t.Value)??0; //using nullable types

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



[nhusers] Re: LINQ Provider: Sum When There Are No Elements

2011-04-14 Thread Ricardo Peres
Hello, Vahid!

Yes, I know... the problem is that Value is not a nullable type; what
happens is that there are no elements to sum, the same happens when
using SQL: SELECT SUM(Value) FROM AnalogicalValue WHERE 1 = 2
returns NULL.

I solved my problem with:

Object result = session.CreateQuery(select sum(a.Value) from
AnalogicalValue a).UniqueResult();
Int32 sum = result is Int32 ? (Int32) result : 0;

RP



session.CreateQuery(select sum(a.Value) from AnalogicalValue
a).SetParameter(anmid, (Int32)
AnalogicalElementMeasure.ActivePower).UniqueResult();


On Apr 14, 4:42 pm, Vahid vahid.nas...@gmail.com wrote:
 Hello,
 This is the definition of Sum method here:
 public static ***TResult*** SumTSource(
 this IQueryableTSource source,
 ExpressionFuncTSource, ***TResult*** selector)

 As you can see TResult defines the return type of the method based
 on the result of the applying a lambda-expression which is TResult
 too.
 Now try queries like this : (the same rule applies to EF and LINQ to
 SQL)
 var sum = Where(t=...)
 .Sum(t=(decimal?)t.Value)??0; //using nullable types

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



[nhusers] Re: LINQ Provider: Sum When There Are No Elements

2011-04-14 Thread Ricardo Peres
Ooops, forget the text after my signature (RP)!

On Apr 14, 4:53 pm, Ricardo Peres rjpe...@gmail.com wrote:
 Hello, Vahid!

 Yes, I know... the problem is that Value is not a nullable type; what
 happens is that there are no elements to sum, the same happens when
 using SQL: SELECT SUM(Value) FROM AnalogicalValue WHERE 1 = 2
 returns NULL.

 I solved my problem with:

 Object result = session.CreateQuery(select sum(a.Value) from
 AnalogicalValue a).UniqueResult();
 Int32 sum = result is Int32 ? (Int32) result : 0;

 RP

 session.CreateQuery(select sum(a.Value) from AnalogicalValue
 a).SetParameter(anmid, (Int32)
 AnalogicalElementMeasure.ActivePower).UniqueResult();

 On Apr 14, 4:42 pm, Vahid vahid.nas...@gmail.com wrote:







  Hello,
  This is the definition of Sum method here:
  public static ***TResult*** SumTSource(
  this IQueryableTSource source,
  ExpressionFuncTSource, ***TResult*** selector)

  As you can see TResult defines the return type of the method based
  on the result of the applying a lambda-expression which is TResult
  too.
  Now try queries like this : (the same rule applies to EF and LINQ to
  SQL)
  var sum = Where(t=...)
  .Sum(t=(decimal?)t.Value)??0; //using nullable types

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



[nhusers] Re: LINQ Provider: Sum When There Are No Elements

2011-04-14 Thread Vahid
In my post Value is not a nullable type. So you saw that casting.

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



[nhusers] Re: LINQ provider does not work with IN-queries having an empty set

2011-01-03 Thread Stefan Wenig
What do you mean, it works. Correct results, or just executing
without errors? (What if Name actually IS null?)

On Dec 28 2010, 4:30 pm, Gabriel Schenker gnschen...@gmail.com
wrote:
 one easy solution would be to change the code such as that the
 following query is generated

        select * from Foo where Name in (null)

 this works at least on SQL Server and Oracle (even in combined where
 statements like

       select * from Foo where Name in (null) or Name like 'A%'

 not only works for string but also works for DateTime, bool, int...

 On Dec 28, 7:04 am, Gabriel Schenker gnschen...@gmail.com wrote:

  I am completely fine with something like 1=2 since the problem are
  combined statements like

  session.QueryFoo().Where(x = someIds.Contains(x.Id) ||
  x.Name.StartsWith(A));

  which would then result in

  select * from Foo where 1=2 or Name like 'A%'

  which in turn yields an expected/correct/valid result

  On Dec 27, 8:23 pm, Diego Mijelshon di...@mijelshon.com.ar wrote:

   If I'm not mistaken, the code is either
   src/NHibernate/Linq/Functions/QueryableGenerator.is (class
   CollectionContainsGenerator)
   or 
   src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessContains.cs
   (the latter sounds more likely)

   However, consider Richard's comment to that issue:

   *[...] what SQL would you expect to be generated?*

   where column in empty is just like saying where 1=2. The best
   workaround is to just return an empty list or null from your method if you
   get an empty list, without even bothering to go to the db.

       Diego

   On Mon, Dec 27, 2010 at 18:43, Gabriel Schenker 
   gnschen...@gmail.comwrote:

There is an open bug (NH-2400) regarding the fact that the NHibernate
3.0 LINQ provider does not work correctly for empty collections when
creating an IN query, e.g.

session.QueryFoo().Where(x = someIds.Contains(x.Id));

and someIds is empty. This leads to the exception An empty
parameter-list generate wrong SQL; parameter name 'p1'.

We are currently moving from NHibernate 2.x to 3.0 GA and find that
this very bug causes us a lot of headache! We use such where
statements all over the place and it worked just fine with the LINQ
provider for NH 2.x.

Is there a fix available or a work around without us having to
refactor all our code...?
If no fix or workaround is available, then can somebody with a more
intimate knowledge of the LINQ provider give a hint where I would have
to go to change the code.

--
You received this message because you are subscribed to the Google 
Groups
nhusers group.
To post to this group, send email to nhus...@googlegroups.com.
To unsubscribe from this group, send email to
nhusers+unsubscr...@googlegroups.comnhusers%2bunsubscr...@googlegroups.com
 
.
For more options, visit this group at
   http://groups.google.com/group/nhusers?hl=en.

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



[nhusers] Re: LINQ provider does not work with IN-queries having an empty set

2010-12-28 Thread Gabriel Schenker
I am completely fine with something like 1=2 since the problem are
combined statements like

session.QueryFoo().Where(x = someIds.Contains(x.Id) ||
x.Name.StartsWith(A));

which would then result in

select * from Foo where 1=2 or Name like 'A%'

which in turn yields an expected/correct/valid result

On Dec 27, 8:23 pm, Diego Mijelshon di...@mijelshon.com.ar wrote:
 If I'm not mistaken, the code is either
 src/NHibernate/Linq/Functions/QueryableGenerator.is (class
 CollectionContainsGenerator)
 or src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessContains.cs
 (the latter sounds more likely)

 However, consider Richard's comment to that issue:

 *[...] what SQL would you expect to be generated?*

 where column in empty is just like saying where 1=2. The best
 workaround is to just return an empty list or null from your method if you
 get an empty list, without even bothering to go to the db.

     Diego

 On Mon, Dec 27, 2010 at 18:43, Gabriel Schenker gnschen...@gmail.comwrote:







  There is an open bug (NH-2400) regarding the fact that the NHibernate
  3.0 LINQ provider does not work correctly for empty collections when
  creating an IN query, e.g.

  session.QueryFoo().Where(x = someIds.Contains(x.Id));

  and someIds is empty. This leads to the exception An empty
  parameter-list generate wrong SQL; parameter name 'p1'.

  We are currently moving from NHibernate 2.x to 3.0 GA and find that
  this very bug causes us a lot of headache! We use such where
  statements all over the place and it worked just fine with the LINQ
  provider for NH 2.x.

  Is there a fix available or a work around without us having to
  refactor all our code...?
  If no fix or workaround is available, then can somebody with a more
  intimate knowledge of the LINQ provider give a hint where I would have
  to go to change the code.

  --
  You received this message because you are subscribed to the Google Groups
  nhusers group.
  To post to this group, send email to nhus...@googlegroups.com.
  To unsubscribe from this group, send email to
  nhusers+unsubscr...@googlegroups.comnhusers%2bunsubscr...@googlegroups.com 
  
  .
  For more options, visit this group at
 http://groups.google.com/group/nhusers?hl=en.

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



[nhusers] Re: LINQ provider does not work with IN-queries having an empty set

2010-12-28 Thread Gabriel Schenker
one easy solution would be to change the code such as that the
following query is generated

   select * from Foo where Name in (null)

this works at least on SQL Server and Oracle (even in combined where
statements like

  select * from Foo where Name in (null) or Name like 'A%'

not only works for string but also works for DateTime, bool, int...


On Dec 28, 7:04 am, Gabriel Schenker gnschen...@gmail.com wrote:
 I am completely fine with something like 1=2 since the problem are
 combined statements like

 session.QueryFoo().Where(x = someIds.Contains(x.Id) ||
 x.Name.StartsWith(A));

 which would then result in

 select * from Foo where 1=2 or Name like 'A%'

 which in turn yields an expected/correct/valid result

 On Dec 27, 8:23 pm, Diego Mijelshon di...@mijelshon.com.ar wrote:







  If I'm not mistaken, the code is either
  src/NHibernate/Linq/Functions/QueryableGenerator.is (class
  CollectionContainsGenerator)
  or src/NHibernate/Linq/Visitors/ResultOperatorProcessors/ProcessContains.cs
  (the latter sounds more likely)

  However, consider Richard's comment to that issue:

  *[...] what SQL would you expect to be generated?*

  where column in empty is just like saying where 1=2. The best
  workaround is to just return an empty list or null from your method if you
  get an empty list, without even bothering to go to the db.

      Diego

  On Mon, Dec 27, 2010 at 18:43, Gabriel Schenker gnschen...@gmail.comwrote:

   There is an open bug (NH-2400) regarding the fact that the NHibernate
   3.0 LINQ provider does not work correctly for empty collections when
   creating an IN query, e.g.

   session.QueryFoo().Where(x = someIds.Contains(x.Id));

   and someIds is empty. This leads to the exception An empty
   parameter-list generate wrong SQL; parameter name 'p1'.

   We are currently moving from NHibernate 2.x to 3.0 GA and find that
   this very bug causes us a lot of headache! We use such where
   statements all over the place and it worked just fine with the LINQ
   provider for NH 2.x.

   Is there a fix available or a work around without us having to
   refactor all our code...?
   If no fix or workaround is available, then can somebody with a more
   intimate knowledge of the LINQ provider give a hint where I would have
   to go to change the code.

   --
   You received this message because you are subscribed to the Google Groups
   nhusers group.
   To post to this group, send email to nhus...@googlegroups.com.
   To unsubscribe from this group, send email to
   nhusers+unsubscr...@googlegroups.comnhusers%2bunsubscr...@googlegroups.com

   .
   For more options, visit this group at
  http://groups.google.com/group/nhusers?hl=en.

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



[nhusers] Re: LINQ Provider again

2008-11-24 Thread epitka

Isn't there one already? I am using it.

On Nov 24, 3:13 pm, mhnyborg [EMAIL PROTECTED] wrote:
 I think that we all know that NH needs a full-blown LINQ Provider. If
 it had one, then there would be no competition - POCO, LINQ and fluent-
 NH is VERY hard to beat.

 But have do we get started? Oren (http://ayende.com/Blog/archive/
 2008/11/01/developing-linq-to-nhibernate.aspx)  estimates that it's
 will take a minimum of 3 months for him and that the community will
 have to find a sponsor to raise the money.

 I have some ideas.  Don't know if any one can use it but I see it as a
 start.

 - Get som inspiration from Rob Conery (http://blog.wekeroad.com/blog/
 subsonic-3-0-preview-2/?disqus_reply=3738324#comment-3738324)
 - Use Matt Warrens LINQ IQueryable Toolkit on CodePlex 
 (http://www.codeplex.com/IQToolkit/Release/ProjectReleases.aspx?ReleaseId=19725)
 - Trim all fat from NHibernate, with a don't-look-back attitude
 - Why lean on Hibernate if JBoss is not supporting NHibernate? try to
 look athttp://www.hibernate.org/343.htmlthis site needs a serious
 update or a redirect to NHFORGE.
 - Start in the small and let it grow

 I have to say that I not a super programmer but I could help with the
 testing. and I could also donate some money if that what it takes.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
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
-~--~~~~--~~--~--~---



[nhusers] Re: LINQ Provider again

2008-11-24 Thread Tuna Toksöz
It's not full blown.

On Mon, Nov 24, 2008 at 11:19 PM, epitka [EMAIL PROTECTED] wrote:


 Isn't there one already? I am using it.

 On Nov 24, 3:13 pm, mhnyborg [EMAIL PROTECTED] wrote:
  I think that we all know that NH needs a full-blown LINQ Provider. If
  it had one, then there would be no competition - POCO, LINQ and fluent-
  NH is VERY hard to beat.
 
  But have do we get started? Oren (http://ayende.com/Blog/archive/
  2008/11/01/developing-linq-to-nhibernate.aspx)  estimates that it's
  will take a minimum of 3 months for him and that the community will
  have to find a sponsor to raise the money.
 
  I have some ideas.  Don't know if any one can use it but I see it as a
  start.
 
  - Get som inspiration from Rob Conery (http://blog.wekeroad.com/blog/
  subsonic-3-0-preview-2/?disqus_reply=3738324#comment-3738324)
  - Use Matt Warrens LINQ IQueryable Toolkit on CodePlex (
 http://www.codeplex.com/IQToolkit/Release/ProjectReleases.aspx?ReleaseId=19725
 )
  - Trim all fat from NHibernate, with a don't-look-back attitude
  - Why lean on Hibernate if JBoss is not supporting NHibernate? try to
  look athttp://www.hibernate.org/343.htmlthis site needs a serious
  update or a redirect to NHFORGE.
  - Start in the small and let it grow
 
  I have to say that I not a super programmer but I could help with the
  testing. and I could also donate some money if that what it takes.
 



-- 
Tuna Toksöz
http://www.tunatoksoz.com

Typos included to enhance the readers attention!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
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
-~--~~~~--~~--~--~---