| Author |
hibernate exception SQLGrammarException could not fetch initial value for increment
|
V Patil
Ranch Hand
Joined: Oct 04, 2008
Posts: 36
|
|
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
Joined: Feb 27, 2010
Posts: 23
|
|
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
Joined: Mar 01, 2010
Posts: 55
|
|
|
It could be a syntax problem with the SQL query which is built during the runtime.
|
 |
Talha Kabakus
Greenhorn
Joined: Feb 27, 2010
Posts: 23
|
|
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
Joined: Mar 01, 2010
Posts: 55
|
|
|
Can you please send the full error trace and also the hbm.file
|
 |
Talha Kabakus
Greenhorn
Joined: Feb 27, 2010
Posts: 23
|
|
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
Joined: Mar 01, 2010
Posts: 55
|
|
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
Joined: Feb 27, 2010
Posts: 23
|
|
Shinelin Samuel wrote:
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
Joined: Mar 09, 2010
Posts: 1
|
|
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
|
 |
 |
|
|
subject: hibernate exception SQLGrammarException could not fetch initial value for increment
|
|
|