-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: could not get next sequence value
PostPosted: Wed Mar 17, 2010 12:15 pm 
Newbie

Joined: Mon Mar 15, 2010 1:03 pm
Posts: 2
Hi I am a newbie Hibernate user and I am trying to follow the Hibernate tutorial "The first Hibernate Application". However, instead of Maven I am using ANT and instead of HSQLDB I am using Oracle. My code is identical to the tutorial (except for oracle-specific configurations in hibernate.cfg.xml).

Help on this would be greatly appreciated. Thanks in advance!

I am getting the following error:

[java] Hibernate: select BOE_DEV.hibernate_sequence.nextval from dual
[java] Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not get next sequence value
[java] at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
[java] at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
[java] at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:119)
[java] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
[java] at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
[java] at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50)
[java] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
[java] at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:563)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:551)
[java] at org.hibernate.impl.SessionImpl.save(SessionImpl.java:547)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:592)
[java] at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:342)
[java] at $Proxy0.save(Unknown Source)
[java] at org.hibernate.tutorial.EventManager.createAndStoreEvent(Unknown Source)
[java] at org.hibernate.tutorial.EventManager.main(Unknown Source)
[java] Caused by: java.sql.SQLException: ORA-02289: sequence does not exist
[java] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
[java] at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
[java] at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
[java] at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
[java] at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
[java] at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:810)
[java] at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1039)
[java] at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:850)
[java] at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1134)
[java] at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3339)
[java] at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3384)
[java] at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:98)
[java] ... 17 more


Top
 Profile  
 
 Post subject: Re: could not get next sequence value
PostPosted: Thu Mar 18, 2010 5:58 am 
Newbie

Joined: Mon May 11, 2009 11:16 am
Posts: 13
I quess you found it already but I didnt do a good deed today, so I will point out your error
java.sql.SQLException: ORA-02289: sequence does not exist

You should create the sequence before.

Try something like this
CREATE SEQUENCE hibernate_sequence START WITH 1 INCREMENT BY 1 NOCYCLE;


Top
 Profile  
 
 Post subject: Re: could not get next sequence value
PostPosted: Thu Mar 18, 2010 12:59 pm 
Newbie

Joined: Mon Mar 15, 2010 1:03 pm
Posts: 2
Thanks!

adding that sequence fixed the problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.