---
title: "使用Hibernate时，出现java.lang.UnsupportedOperationException: Update queries only supp"
author: "wnzz95391511"
date: "2010-12-19T22:56:46Z"
tags: ["Hibernate", "Java", "MySQL", "SQL"]
categories: ["企业架构"]
slug: "hibernate-java-lang-unsupportedoperationexception-update-queries-only-supp"
draft: false
lastmod: "2010-12-19T22:56:46Z"
id: 846861
url: "https://perfectlife.iteye.com/blog/846861"
---

使用Hibernate时，出现java.lang.UnsupportedOperationException: Update queries only supported through HQL异常的解决方法 收藏
在使用mysql和hibernate进行开发时，发现使用native sql进行数据库插入操作时，抛出
java.lang.UnsupportedOperationException: Update queries only supported through HQL异常
Googling后发现有人提出这是由于hibernate版本问题，需要更新到3.2.x的版本，查看自己的hibernate版本是3.1.1。
于是下载了hibernate3.2.*.jar加入lib，重新运行。insert语句正确执行。