Hi,
I use JDK1.4.1 + hibernate-3.1 + oracle9.
The section of mapping file for generating a primary key is as following:
Code:
<generator class="seqhilo">
<param name="sequence">HIBERNATE_UNIQUE_KEY</param>
<param name="max_lo">100</param>
</generator>
I have already create a table named "HIBERNATE_UNIQUE_KEY" with a field named "nextval". DataType of nextval is number(38).
When I save the object, the exception says as following:
Code:
Hibernate:
select
GDW2.HIBERNATE_UNIQUE_KEY.nextval
from
dual
20:07:17,307 WARN JDBCExceptionReporter:71 - SQL Error: 2289, SQLState: 42000
20:07:17,307 ERROR JDBCExceptionReporter:72 - ORA-02289: serial(number) does not exist
org.hibernate.exception.SQLGrammarException: could not get next sequence value
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
Could anyone tell me how to set the parameters and environment for
<generator class="seqhilo">?
And, is it imperative that I should create several tables for several entities which need a generated key? Is there anyway to share the sequence table with different fields?
Also, in my environment, what is the most efficient algorithm?
Thanks in advance.