开发者

"missing SET keyword" on hibernateTemplate bulkUpdate

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜