• 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
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

hibernate exception SQLGrammarException could not fetch initial value for increment

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
org.hibernate.exception.SQLGrammarException: could not fetch initial value for increment generator
this excepetion is shown in console
cannot increment the generator id.
I am getting this error when i am using Hibernate 3.0 and its working fine with Hibernate 2.0.
Please Help.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
same problem occurs to me too.. thanks for topic..
I hope that someone can help us.. I think we should do some changes in hbm.xml file.
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It could be a syntax problem with the SQL query which is built during the runtime.
 
Talha Kabakus
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shinelin Samuel wrote:It could be a syntax problem with the SQL query which is built during the runtime.


first, thank you for your reply.. do you know how can we correct it? I use HQL's session.save(Object o) method.
 
Shinelin Samuel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you please send the full error trace and also the hbm.file
 
Talha Kabakus
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shinelin Samuel wrote:Can you please send the full error trace and also the hbm.file


of course, thanks for your interest.

hbm.xml file:

Full Error Trace:
 
Shinelin Samuel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Caused by: java.sql.SQLException: ORA-00933: SQL command not properly ended



Seems like the SQL statement formed using generator increment class, has the issue,.

Have you turned on show-sql parameter in your hibernate config file, In such case I think it will log the SQL statement in your console.

Regards,
Shinelin
 
Talha Kabakus
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Shinelin Samuel wrote:

Caused by: java.sql.SQLException: ORA-00933: SQL command not properly ended



Seems like the SQL statement formed using generator increment class, has the issue,.

Have you turned on show-sql parameter in your hibernate config file, In such case I think it will log the SQL statement in your console.

Regards,
Shinelin


OK, I added 'show-sql' parameter; but it gives exactly same exception report..
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the same problem. From google I found this topic, but without solution.
but ,but finally
I solved it by removing the "username" and "password" in the config file of hibernate(hibernate.cfg.xml)
And I changed the generator type from "increment" to "identity".(My id type is "integer", not big-decimal, my db is derby)
this is my case, I think it may be helpful, so....
Not good English, sorry
 
Did Steve tell you that? Fuh - Steve. Just look at this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic