Some applications need to create criteria queries in "detached mode", where the Hibernate session is not available. Then you can execute the search in an arbitrary session.
createSubcriteria()method on your existing criteria object and incorporate it via the
getSQL()method to get the actual SQL that will be produced. You can even add the argument:
returnExecutableSqland get the actual executable SQL.