GeeCON Prague 2014*
The moose likes Object Relational Mapping and the fly likes Bulk Update syntax issues in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Bulk Update syntax issues in hibernate" Watch "Bulk Update syntax issues in hibernate" New topic
Author

Bulk Update syntax issues in hibernate

Kenny Kuriakose
Greenhorn

Joined: Nov 20, 2006
Posts: 7
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

Joined: Mar 18, 2004
Posts: 32
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.


Vijay dharap,
<a href="http://dharapvj.wordpress.com" rel="nofollow">Blog</a>
Kenny Kuriakose
Greenhorn

Joined: Nov 20, 2006
Posts: 7
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bulk Update syntax issues in hibernate