How to pass IN Operator parameter to NHibernate?

Hi

I am trying to pass a long array for a named query (native sql) for use in IN STATEMENT: Like this:

(...) WHERE Identifier IN (: pIdes)

I tried to miss my words for how long []:

 ctx.GetNamedQuery("NamedQueryName")                                          
                   .SetParameter<long[]>("pIdes", Identificators)
                   .List<EmpreendimentoInputReport>();

and as a string

 ctx.GetNamedQuery("NamedQueryName")                                          
                   .SetParameter<string>("pIdes", Identificators)
                   .List<EmpreendimentoInputReport>();

When the parameter is a string returning nothing, whem long [] returns this oracle error:

"Oracle.DataAccess.Client.OracleException: ORA-00932: tipos de dados inconsistent: esperava NUMBER obteve BINARY"

Can anybody help me?

+5
source share
1 answer

Use SetParameterListinstead SetParameter.

+10
source

All Articles