Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Hibernate error ORA-02289: sequence does not exist [SOLVED]

Hibernate error ORA-02289: sequence does not exist [SOLVED]

Scheduled Pinned Locked Moved Database
javadatabaseoraclecomtesting
4 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Valentinor
    wrote on last edited by
    #1

    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
    
    Richard DeemingR V 2 Replies Last reply
    0
    • V Valentinor

      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
      
      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      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?

      Managing Sequences[^]:

      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

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      V 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        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?

        Managing Sequences[^]:

        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

        V Offline
        V Offline
        Valentinor
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • V Valentinor

          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
          
          V Offline
          V Offline
          Valentinor
          wrote on last edited by
          #4

          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".

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups