In the query you use:
from Foo f where f.SSN = :ssn

Then:
Session.GetQuery("queryname").SetParameter("ssn", bytes).List<Foo>()...



2011/6/7, Stephen Boyd <[email protected]>:
> Hello,
>
> Is it possible to pass a byte[] parameter to a NamedQuery?
>
> This works using Criterion:
> /// <summary>
> /// Get a list of Students by SSN
> /// </summary>
> /// <param name="ssn">byte[]: SSN of the object(s) to retrieve</param>
> /// <returns>Student Object IList</returns>
> public IList<Student> GetBySSN(byte[] ssn)
> {
>     IList<Student> students = null;
>     using (ISession session = NHibernateSessionHelper.OpenSession())
>     {
>         students = session
>             .CreateCriteria(typeof(Student))
>             .Add(Restrictions.Eq("Last4SSN", ssn))
>             .List<Student>();
>     }
>     return students;
>
> I would rather use a NamedQuery but have no idea how to pass a byte[]
> as a prameter.
>
> Thank you in advance for your assistance.
>
> --
> 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.
>
>

-- 
Enviado desde mi dispositivo móvil

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