• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate exception SQLGrammarException could not fetch initial value for increment

 
V Patil
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • 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.
 
Talha Kabakus
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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.
 
Shinelin Samuel
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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..
 
Wolf Lee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic