File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate generates "bad" SQL in Bulk update

 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Philippe Desrosiers
Ranch Hand
Posts: 138
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I ended up using getSession().createQuery(hql).executeUpdate() instead.

hope this helps...
 
Suresh Kumar Ramasamy
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic