Hibernate error ORA-02289: sequence does not exist [SOLVED]
-
What else could cause this error beside the sequence not being created? I have recreated the sequence using SQL code, also recreated it using Oracle SQL Developer "New Sequence" menu but still nothing. I only have a single class and and a single table, being a learning project, I don't want to complicate things. Project made using Maven. hibernate.cfg.xml:
org.hibernate.dialect.Oracle10gDialect oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@localhost:1521:xe SYSTEM testingdatabasepassword
Person.java
package com.testing.classes;
public class Person {
private int id; private String firstName; private String lastName; private int age; public Person(String firstName, String lastName, int age) { this.firstName = firstName; this.lastName = lastName; this.age = age; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; }
}
Person.hbm.xml
CREATE\_PERSON\_ID
-
What else could cause this error beside the sequence not being created? I have recreated the sequence using SQL code, also recreated it using Oracle SQL Developer "New Sequence" menu but still nothing. I only have a single class and and a single table, being a learning project, I don't want to complicate things. Project made using Maven. hibernate.cfg.xml:
org.hibernate.dialect.Oracle10gDialect oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@localhost:1521:xe SYSTEM testingdatabasepassword
Person.java
package com.testing.classes;
public class Person {
private int id; private String firstName; private String lastName; private int age; public Person(String firstName, String lastName, int age) { this.firstName = firstName; this.lastName = lastName; this.age = age; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; }
}
Person.hbm.xml
CREATE\_PERSON\_ID
I don't use Oracle, so this is just a guess: do you need to grant
SELECT
permissions on the sequence to the user you're connecting as?To use a sequence, your schema must contain the sequence or you must have been granted the
SELECT
object privilege for another user's sequence.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
I don't use Oracle, so this is just a guess: do you need to grant
SELECT
permissions on the sequence to the user you're connecting as?To use a sequence, your schema must contain the sequence or you must have been granted the
SELECT
object privilege for another user's sequence.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Well, as you can see in my hibernate.cfg.xml, I'm using SYSTEM, so that isn't the problem unfortunately. Edit: After some more research I found the problem. All the sites with tutorials google suggested were using either or SEQUENCE_NAME The problem is that hibernate devs changed to . It is weird that you get sequence does not exist error, instead of something like invalid value for param or something to suggest that is the problem.
-
What else could cause this error beside the sequence not being created? I have recreated the sequence using SQL code, also recreated it using Oracle SQL Developer "New Sequence" menu but still nothing. I only have a single class and and a single table, being a learning project, I don't want to complicate things. Project made using Maven. hibernate.cfg.xml:
org.hibernate.dialect.Oracle10gDialect oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@localhost:1521:xe SYSTEM testingdatabasepassword
Person.java
package com.testing.classes;
public class Person {
private int id; private String firstName; private String lastName; private int age; public Person(String firstName, String lastName, int age) { this.firstName = firstName; this.lastName = lastName; this.age = age; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; }
}
Person.hbm.xml
CREATE\_PERSON\_ID
To solve this problem you have to change:
SEQUENCE\_NAME
into
SEQUENCE\_NAME
The value for param was changed from just "sequence" to "sequence_name".