开发者

"missing SET keyword" on hibernateTemplate bulkUpdate

开发者 https://www.devze.com 2023-02-17 18:55 出处:网络
My namedQuery: @NamedQuery(name = \"myUpdate\", query = \"update User set country = \'EN\' where user.id = ?\")

My namedQuery:

@NamedQuery(name = "myUpdate", query = "update User set country = 'EN' where user.id = ?")

In service layer:

Query query = sessionFactory.getCurrentSession.getNamedQuery("myUpdate");
getHibernateTemplate.bulkUpdate(query.getQueryString(), 开发者_C百科id);

I get an error:

Hibernate: update User, set country=EN where id = 2343 ORA-00971: missing SET keyword

Anybody now how can resolve this problem?


Did you specify the oracle dialect in the hibernate.cfg.xml file? The named queries you provide are translated by Hibernate into a DB-specific query. If the dialect is wrong, the translations produces SQL which a may be wrong for the target database.

See the comma in update User, set?


It seems that there is a limitation in Hibernate regarding bulk update and implicit/explicit joins. I found a solution at http://www.techques.com/question/1-5368522/Why-this-hibernate-template-bulkUpdate-doesn't-work

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号