We have a table with a composite primary key mapped, as shown below:
mapping.CompositeId().KeyReference(e => e.Node).KeyProperty(e => e.DtFr).UnsavedValue("any");
We need to delete several rows from the table by complex condition, for example n.Node.Contract.Code = "1234"
According to the solution we tried next HQL:
delete from Entity n where n in (select c from Entity c where c.Node.Contract.Code = "1234")
But in the generated SQL-query there are no parentheses around the primary key columns:
select ... from ENTITY n where n.IDNODE, n.DTFR in (select c.IDNODE, c.DTFR ...
We tried explicitly to add parentheses in HQL (where (n) in
), but NHibernate ignores them.
What can we do to make NHibernate generate the correct SQL?
Version of NHibernate is 4.1.1.4000
, RDBMS is Oracle 10.2
.
SQL dialect is set to NHibernate.Dialect.Oracle10gDialect
.