• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Hibernate generates "bad" SQL in Bulk update

 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I ended up using getSession().createQuery(hql).executeUpdate() instead.

hope this helps...
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seven years later, changing and old project i find myself with this issue, nice ...
 
We must storm this mad man's lab and destroy his villanous bomb! Are you with me tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic