I'm using NHibernate 3.0 LINQ against an Oracle 11g R2 and wanted to use the 
.Any statement in LINQ

from p in session.Query<Project>()
   where p.Personprojects.Any(pp => pp.Id.PersonId == userId)
   select p

(pp.Id is a composite ID with PersonId and ProjectId)

This creates the following SQL:

select
 project0_.PROJECT_ID as PROJECT1_92_,
 (... lots of properties snipped...),
 project0_.VALIDTODATE as VALIDTO25_92_ 
from PROJECT project0_ 
where exists (
select
 (
personproj1_.PROJECT_ID,
 personproj1_.PERSON_ID)
 
from PERSONPROJECT personproj1_ 
where project0_.PROJECT_ID=personproj1_.PROJECT_ID and
 personproj1_.PERSON_ID=4042 /* :p0 */)

Oracle complains with "ORA-00907: missing right parenthesis"

I narrowed it down to the parentheses in the second select:

select
 (
  personproj1_.PROJECT_ID,
  personproj1_.PERSON_ID)

If I remove those the query works fine. 

Oracle doesn't like parentheses around column names in it's select. A simple

select (PROJECT_ID, PERSON_ID)
from PERSONPROJECT  

will also fail.

Is this an NHibernate bug or am I doing something stupid? If I wanted to 
change this behavior in NHibernate and make a patch, do you have any 
pointers to where in the NHibernate source I should start?


 

-- 
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