• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic