-->
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.  [ 1 post ] 
Author Message
 Post subject: Hibernate-Annotations, no sequence from Oracle-Database
PostPosted: Tue Feb 21, 2006 3:57 am 
Newbie

Joined: Tue Feb 21, 2006 3:37 am
Posts: 2
Hi, i need help with Hibernate Version 3.1.2 and Annotations 3.1.8. I am using an Oracle 9i Database. I have the following error when trying to use a generated sequence for the id of my table.

Hibernate: select my_sequence.nextval from dual
2906 WARN JDBCExceptionReporter - SQL Error: 2289, SQLState: 42000
2906 ERROR JDBCExceptionReporter - ORA-02289: sequence does not exist

org.hibernate.exception.SQLGrammarException: could not get next sequence value
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:96)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:91)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:531)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:523)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:519)
at hiberAnnoTest.test.main(test.java:37)
Caused by: java.sql.SQLException: ORA-02289: sequence does not exist

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:830)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2672)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:527)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:75)


My Code looks like this.

@javax.persistence.SequenceGenerator(
name = "SEQ_GEN",
sequenceName="my_sequence"

)

@Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="SEQ_GEN")
public Long getId() {
return id;
}



Do anyone know how to handle this? I am new with annotations and i didn`t found any explanation in the manual for this problem.
I also tried GeneratorType.AUTO, and .IDENTITY and .TABLE



EDIT:Before this i used Hibernate with XDoclet and generator-class="increment" which worked fine


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

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.