This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate: Native SQL [update] Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Hibernate: Native SQL [update]" Watch "Hibernate: Native SQL [update]" New topic
Author

Hibernate: Native SQL [update]

Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
Hi,

While triying to execute an update query using native SQL ,i'm getting an exception as follows.

java.lang.UnsupportedOperationException: Update queries only supported through HQL at org.hibernate.impl.AbstractQueryImpl.executeUpdate(AbstractQueryImpl.java:607)

My code is like



I can change to HQL, but I like to know why this exception is thrown.

Why is native SQL for update not supported by Hibernate.

Thanks in Advance
Chandrasekhar S


"Luck is when opportunity meets preparation"
Chandra Sekhar
Ranch Hand

Joined: Sep 26, 2003
Posts: 90
Hi,

When i changed my version to hibernate3.2 its working.


Thanks
Chandrasekhar S
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4967

Indeed, there shouldn't be a problem with a native query update using Hibernate. The following works fine on Hibernate 3.2.5 on MySQL:



Author of Hibernate Made Easy, What is WebSphere???, JSF 2.0 Made Easy and the SCJA Certification Guides
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: Native SQL [update]
 
Similar Threads
Problem with Update
HQL and Oracle
Stored Procedure inside HQL query?
why for HQL?
"like clause" in HQL?