aspose file tools*
The moose likes Object Relational Mapping and the fly likes Hibernate generates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate generates "bad" SQL in Bulk update" Watch "Hibernate generates "bad" SQL in Bulk update" New topic
Author

Hibernate generates "bad" SQL in Bulk update

Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
I don't kow if this is an issue with Hibernate or Spring, but I'm using the Spring HibernateDaoSupport class from Spring for my Dao.

When calling a bulkUpdate, Hibernate is generating "bad" SQL. Essentially, the SQL generator is adding a comma after the table name, which causes an SQL Exception.

Here's the function call:


The relevant Entities are Session, which contains a reference to a ProvisioningProfile, which itself refers to a Device. (foreign keys all around.)

The SQL that hibernate is generating is:


As you can see, that extraneous comma, right after "apns.Session" is causing the problem. This SQL is just not valid.

Has anyone else had this problem? How can I fix this?

I'm using Hibernate 3.3.2 GA and Spring 2.5.6.
Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
Well, the beautiful sound of crickets is gratifying, but I have trouble believing that no one in the history of the universe has ever attempted an HQL Update query before. Seriously? no one?

Well, consider this a bump, then, I guess.
Arundhathi Menon
Ranch Hand

Joined: Jan 14, 2004
Posts: 113
Has anybody got a solution to this? I have the same problem

Hibernate seems to append a ',' after the table name in the update HQL

Thanks
Menon


SCJP , SCWCD , SCBCD , SCDJWS
Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
I ended up using getSession().createQuery(hql).executeUpdate() instead.

hope this helps...
Suresh Kumar Ramasamy
Greenhorn

Joined: Mar 18, 2008
Posts: 7
More than an year old thread. When I googled for "hibernate update generates additional comma", I got this as the first result. Hence thought of updating my experience. For me, even getSession().createQuery(hql).executeUpdate() doesn't work. (I am still at 3.2.6.ga). With further luck, I came across this Hibernate (non)issue. Hope this is useful to someone.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate generates "bad" SQL in Bulk update