"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
精彩评论