How to run native SQL from Hibernate?

Hibernate 2 provides createSQLQuery() method on the Session for native SQL. However, this method must return a persistent class and can be costly at times.

When raw power is needed, get a JDBC connection by calling connection() method on the Session.

Technorati Tags:

Comments

Anonymous said…
this is not true for Hibernate 3 which allow return of any scalar or object
Anonymous said…
Actually it is still true for 3 - you can still grab a JDBC Connection from the Session if you want.

Of cause you can also do session.createSQLQuery() as well

Popular Posts