I have a NHibernate criteria, from which I need to get the SQL query. I tried the various methods from here. However, the query which I get does not have the parameters in it(it has a '?' in place of that, just like mentioned over here and here). Also, at least one thing that does not work is criteria.setMaxResults(n).
I also tried NHibernate interceptors. However, the query which I get in the OnPrepareStatement(sql) also does not have the parameters. Is there any other way of getting the sql query from the criteria?
PS:- The criteria is created in the first place since its easier to work with them for complicated business needs. However, I need to do an export of data, which is awesomely slow through criteria. I am trying to get the query from the criteria, and then do a bcp export from that.