Hi,
 
I am using nHibernate 3.3.1.4000 with sprint.net with Oracle.  I have a 
table that contains available certificates.  I need to retrieve the first 
available certificate from the table, and then mark it is used.  I have 
used row level successfully in other places but here I need to use it with 
batching because I only want to lock one row.  I am using the criteria API 
and set the lock mode with something like 
 
crit.SetLockMode(LockMode.Upgrade);
crit.SetFirstResult(0);
crit.SetMaxResults(1);
 
The problem is that nHibernate generates the following query that does not 
run in Oracle.
 
Here is the query as captured through NHibernate profiler.
 
select CertNmbr75_0_,
       TypeCode75_0_,
       ObjectType75_0_,
       Available75_0_,
       StartDate75_0_,
       ExpiryDate75_0_,
       CreateDate75_0_,
       UpdateDate75_0_
from   (SELECT this_.CertNmbr   as CertNmbr75_0_,
               this_.TypeCode   as TypeCode75_0_,
               this_.ObjectType as ObjectType75_0_,
               this_.Available  as Available75_0_,
               this_.StartDate  as StartDate75_0_,
               this_.ExpiryDate as ExpiryDate75_0_,
               this_.CreateDate as CreateDate75_0_,
               this_.UpdateDate as UpdateDate75_0_
        FROM   LW_PromotionCertificate this_
        WHERE  this_.ObjectType = 'Promotion' /* :p0 */
               and this_.TypeCode = 'ABCDEF' /* :p1 */
               and this_.Available = 1 /* :p2 */)
where  rownum <= 1 /* :p3 */
for update of this_.CertNmbr
 
Any help will be greatly appreciated.
 
Thanks,
 
Waqar
 
 

 

 

 

 

 

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

Reply via email to