Oracle IN clause with tuples using NHibernate components

205 Views Asked by At

I've declared some entity (named Employee) with FluentNHibernate mapping using CompositeId and ComponentCompositeIdentifier. My component identifier (named Person) consists of two fields:

  • LastName
  • FirstName.

When I look for employees using single person, everything works great. I need to look for employees by list of persons:

var result = from em in Session.Query<Employee>() where persons.Contains(em.Person)

Is NHibernate able to generate some sort of tuple expressions, like that? I'm using Oracle database.

SELECT * FROM Employees WHERE (FirstName, LastName) IN (('Guy', 'Himuro'), ('Karen', 'Colmenares'));
1

There are 1 best solutions below

2
Roman Artiukhin On

It's very likely you need https://github.com/nhibernate/nhibernate-core/pull/2159 to make it work. So currently it's not supported in NHibernate 5.2.