Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bulk Update syntax issues in hibernate

 
Kenny Kuriakose
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to use bulkUpdate(String queryString, Object value[]) method to delete.
In the HBM file, I have the entry as follows:

<query name="central.example"><![CDATA[
delete from
com.example.supplychain.model.central.TableObject tabObject
where tabObject.productId=?
]]></query>

Now I tried invoking in Java code: getHibernateTemplate().bulkUpdate("central.example", new Object[]{"12345"}) gives exception as follows during runtime.

org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: central near line 1, column 1

Can you please let me know what is the mistake.

Thanks in advance

 
Vijay Dharap
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kenny Kuriakose wrote:
getHibernateTemplate().bulkUpdate("central.example", new Object[]{"12345"}) gives exception


HibernaeTemplate.bulkUpdate() does not support Named Query. you must specify the query itself as first parameter.

HibernateTemplate has separate methods for using NamedQuery.. but unfortunately, none seem to support bulkUpdate..

Hope this helps.
 
Kenny Kuriakose
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. We tried by passing the query itself as solution and it is working.

Thanks,
Kenny Kuriakose
SCJP, SCWCD, SCBCD, SCEA-part 1
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic