Hi all,

I have "job queue" table, where several worker processes can take a job 
from.

To "claim" a job, I want to execute the following query:

                    SET @id = 0;

                    UPDATE job
                  INNER JOIN 
                (
                        SELECT id AS tempid,  @id := id;
                        FROM job
                        WHERE active_host IS NULL 
                          AND enabled = 1
                          AND next_start < NOW()
                        ORDER BY next_start ASC
                        LIMIT 1                          
                     ) tmp 
                    ON id = tempid
                    SET active_host = :host;
                    
                    SELECT @id;


This works just fine in the normal MySQL Workbench, but NHibernate keeps 
having issues with the user defined variable @id. Even just executing "SET 
@id = 0" fails:

 var r = session.CreateSQLQuery("SET @id = 1; ").UniqueResult();
"could not execute query\r\n[ SET @id = 1; ]\r\n[SQL: SET @id = 1;]"
inner exception: Fatal error encountered during command execution.

Is it possible to do this using NHibernate?


Thanks!

Danny

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to