"Missing SET keyword" on hibernateTemplate bulkUpdate

My namedQuery:

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

In the service layer:

Query query = sessionFactory.getCurrentSession.getNamedQuery("myUpdate");
getHibernateTemplate.bulkUpdate(query.getQueryString(), id);

I get an error message:

Sleep mode: user update, specify country = EN, where id = 2343 ORA-00971: SET keyword is missing

Can anyone solve this problem now?

+3
source share
2 answers

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

See the comma in update User, set?

0
source

All Articles