Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate: Native SQL [update]

 
Chandra Sekhar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Chandra Sekhar
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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


Thanks
Chandrasekhar S
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic