Oracle custom sequence instead of select hibernate_sequence.
jmichel Mar 13, 2005 1:29 PMHi,
I use Oracle 9i on windows 2000 and JBOSS 4 with EJB3 preview 4.
I want to use the sequences of oracle so, i defined one MY_SEQ
In a entity bean, i have:
@Id(generate = GeneratorType.AUTO, generator = "sequence")
@SequenceGenerator(name = "sequence", sequenceName = "hibernate_sequence")
@Column(name = "COVT_ID", primaryKey=true)
public int getId() {
return m_id;
}
I have created a hibernate_sequence, then everything is OK.
Now, let's use the MY_SEQ sequence
@Id(generate = GeneratorType.AUTO, generator = "sequence")
@SequenceGenerator(name = "sequence", sequenceName = "MY_SEQ")
@Column(name = "COVT_ID", primaryKey=true)
public int getId() {
return m_id;
}
It is not running, i have the next message:
2005-03-13 19:24:41,309 DEBUG [org.hibernate.util.JDBCExceptionReporter] could not get next sequence value [select hibernate_sequence.nextval from dual]
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.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:296)
at org.hibernate.id.SequenceGenerator.generate(SequenceGenerator.java:75)
at org.hibernate.event.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:84)
at org.hibernate.event.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:171)
at org.hibernate.event.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:31)
at org.hibernate.event.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:160)
at org.hibernate.event.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:25)
at org.hibernate.event.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:64)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:574)
at org.jboss.ejb3.entity.EntityManagerImpl.persist(EntityManagerImpl.java:89)
at com.be.o2.server.ejb.session.impl.CoverTypeDAOBean.create(CoverTypeDAOBean.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:77)
at org.jboss.aspects.tx.TxSupport.invokeInOurTx(TxSupport.java:141)
at org.jboss.aspects.tx.TxSupport$Required.serverInvoke(TxSupport.java:438)
at org.jboss.aspects.tx.TxInterceptor.internalInvoke(TxInterceptor.java:112)
at org.jboss.aspects.tx.TxInterceptor.invoke(TxInterceptor.java:60)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:72)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:36)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:80)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:90)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:66)
at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:165)
at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:102)
at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:74)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:295)
at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:169)
at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:259)
at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:321)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:141)
What can i do to use my custom sequence ????????