views:

343

answers:

1

My Microsoft SQL Server 2005 database contains a table that has an XML field that has some important metadata, and under normal SQL I could run the following query and get a list of items which don't have UPC codes set... Unfortunately I'm having a hard time re-creating this query using NHibernate's Criteria API:

SELECT [Id],[meta].value( '(/meta/upc)[1]', 'nvarchar(max)') as upc
FROM 
 [mediaContent].[dbo].[audioVideo]
WHERE
 [meta].value( '(/meta/upc)[1]', 'nvarchar(max)') != ''

Any suggestions?

A: 

Although xml fields can be mapped quite seamlessly, I don't think they can be queried like that with HQL or Criteria.

I would stick to SQL in this case.

Mauricio Scheffer