I am developing a very basic hibernate application and am stuck with the error:
ERROR: ORA-02289: sequence does not exist.
Attached are the related files. I see this question already been asked in stack overflow but none of them could solve the issue. I have created the sequence school_seq
already in Oracle DB.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="hibEx">
<class name="School" table="school">
<id name="id" column="ID" type="int">
<generator class="sequence">
<param name="sequence">SCHOOL_SEQ</param>
</generator>
</id>
<property name="name" column="NAME"></property>
<property name="subject" column="SUBJECT"></property>
<property name="marks" column="MARKS"></property>
</class>
</hibernate-mapping>
POJO CLASS
package hibEx;
public class School {
private String name;
private String subject;
private int marks;
private int id;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public int getMarks() {
return marks;
}
public void setMarks(int marks) {
this.marks = marks;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
First i have created sequence like the below:
CREATE SEQUENCE school_seq
START WITH 411
INCREMENT BY 1;
As i am facing this issue,i have tried multiple practices based on the comments in the group and later altered the table like the below:
alter sequence school_seq
MINVALUE 411
MAXVALUE 1000
NOCYCLE
CACHE 20
NOORDER