The name says createSQL*Query*, "INSERT" is not a query! ;)
You should NOT use createSQLQuery for inserting, creating etc.
It is *ONLY* for querying stuff and return the result.
If you want to do inserts or any other "yucky" :) stuff - then use session.connection().xxx and do it by hand! And this will ofcourse not be visible by Hibernate because you are going behind it's back ;) (Which is quite legal when wanting to tweak something)
/max
Oisin Kim wrote:
Thanks Christian, That's a great assest to our tool chest!
Can you tell me how it affects Hibernate's caching? Or is there somewhere I can read how it might, without searching the sourcecode?
Thanks again, Oisin
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christian Bauer Sent: 16 September 2003 14:00 To: Oisin Kim Cc: [EMAIL PROTECTED] Subject: Re: [Hibernate] Is it possible to execute sql insert statements with hibernate / hibernate serssion object?
On 16 Sep (13:54), Oisin Kim wrote:
"Query q = session.createSQLQuery( "select {e}.empno as {e.empno}, {e}.firstnme as {e.firstnme}, {e}.lastname as {e.lastname} from
employee
{e}", "e", Employee.class );"
I haven't been able to find this method in the current javadocs at
http://www.hibernate.org/hib_docs/api/net/sf/hibernate/Session.html
This is a Hibernate 2.1 feature which is in beta. Check the docs packaged with the distribution, not on the website.
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel