• 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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Hibernate - SQLGrammarException : could not get next sequence value

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm trying to use a sequence in the hibernate mapping. When I tried to insert a record into a table, it gave error while reading the value from sequence. The sequence exist in the database. The select query output by Hibernate is not correct. What am I doing wrong. The details of logs and mapping are given below:-

Logs:-
INFO: Echoing all SQL to stdout
Hibernate: select next value for slk_end_customer_id_seq from dual_slk_end_customer_id_seq
Error:-
exception occured..org.hibernate.exception.SQLGrammarException: could not get next sequence value
Mapping:-
<hibernate-mapping>
<class name="dao.Customer" table="SLK_END_CUSTOMER">
<id name="custid" column="END_CUSTOMER_ID">
<generator class="sequence">
<param name="sequence">slk_end_customer_id_seq</param>
</generator>
</id>

<property name="city" type="string" column="CITY"/>
</class>
</hibernate-mapping>

Thanks in advance
Sanker
 
sanker san
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is resolved. I am using Oracle db and I had HSQLDialect instead of OracleDialect. I changed the following property and it worked.
Old
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
to New
<property name="dialect">org.hibernate.dialect.OracleDialect</property>

Thank you all
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic