Click here to Skip to main content
14,243,622 members
   

Database

 
QuestionMANAGEMENT DOCUMENT Pin
Member 1413102419-Feb-19 2:23
memberMember 1413102419-Feb-19 2:23 
AnswerRe: MANAGEMENT DOCUMENT Pin
Eddy Vluggen19-Feb-19 3:09
mveEddy Vluggen19-Feb-19 3:09 
AnswerRe: MANAGEMENT DOCUMENT Pin
CHill6019-Feb-19 4:14
protectorCHill6019-Feb-19 4:14 
AnswerRe: MANAGEMENT DOCUMENT Pin
Victor Nijegorodov19-Feb-19 9:27
memberVictor Nijegorodov19-Feb-19 9:27 
GeneralRe: MANAGEMENT DOCUMENT Pin
jschell23-Feb-19 11:03
memberjschell23-Feb-19 11:03 
GeneralRe: MANAGEMENT DOCUMENT Pin
Victor Nijegorodov23-Feb-19 11:07
memberVictor Nijegorodov23-Feb-19 11:07 
AnswerRe: MANAGEMENT DOCUMENT Pin
ZurdoDev1-Mar-19 5:52
professionalZurdoDev1-Mar-19 5:52 
QuestionHibernate error ORA-02289: sequence does not exist [SOLVED] Pin
Valentinor16-Feb-19 5:37
memberValentinor16-Feb-19 5:37 
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:
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE hibernate-configuration SYSTEM 
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
	<session-factory>
		<property name="hibernate.dialect">
			org.hibernate.dialect.Oracle10gDialect
		</property>

		<property name="hibernate.connection.driver_class">
			oracle.jdbc.driver.OracleDriver
		</property>

		<property name="hibernate.connection.url">
			jdbc:oracle:thin:@localhost:1521:xe
		</property>

		<property name="hibernate.connection.username">
			SYSTEM
		</property>

		<property name="hibernate.connection.password">
			testingdatabasepassword
		</property>

		<mapping resource="com/testing/classes/Person.hbm.xml" />
	</session-factory>
</hibernate-configuration>


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
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC 
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> 

<hibernate-mapping>
   <class name = "com.testing.classes.Person" table = "PERSON">
      
      <id name = "id" type = "int" column = "ID">
         <generator class="sequence">
            <param name="sequence">CREATE_PERSON_ID</param>
          </generator>   
      </id>
      <property name = "firstName" column = "FIRST_NAME" type = "string"/>
      <property name = "lastName" column = "LAST_NAME" type = "string"/>
      <property name = "age" column = "AGE" type = "int"/>
      
   </class>
</hibernate-mapping>


Sequence:
CREATE SEQUENCE CREATE_PERSON_ID INCREMENT BY 1 START WITH 1 MAXVALUE 9999 MINVALUE 1 CACHE 10;


Testing main:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
Session session = sessionFactory.openSession();

Person person = new Person("Name", "Last name", 48);
session.save(person);  //Eclipse says the error is here
session.beginTransaction().commit();


modified 18-Feb-19 8:55am.

AnswerRe: Hibernate error ORA-02289: sequence does not exist Pin
Richard Deeming18-Feb-19 1:42
mveRichard Deeming18-Feb-19 1:42 
GeneralRe: Hibernate error ORA-02289: sequence does not exist Pin
Valentinor18-Feb-19 2:37
memberValentinor18-Feb-19 2:37 
AnswerRe: Hibernate error ORA-02289: sequence does not exist [SOLVED] Pin
Valentinor18-Feb-19 2:59
memberValentinor18-Feb-19 2:59 
QuestionOracle SQL Developer filter "default tables" [SOLVED] Pin
Valentinor16-Feb-19 3:16
memberValentinor16-Feb-19 3:16 
AnswerRe: Oracle SQL Developer filter "default tables" Pin
Jörgen Andersson16-Feb-19 7:25
protectorJörgen Andersson16-Feb-19 7:25 
GeneralRe: Oracle SQL Developer filter "default tables" Pin
Valentinor16-Feb-19 7:54
memberValentinor16-Feb-19 7:54 
AnswerRe: Oracle SQL Developer filter "default tables" Pin
Valentinor16-Feb-19 8:04
memberValentinor16-Feb-19 8:04 
QuestionCan't Get Required Output while executing Store Procedure. Any help would be appreciated ? Pin
K K Shah13-Feb-19 23:18
member K K Shah13-Feb-19 23:18 
AnswerRe: Can't Get Required Output while executing Store Procedure. Any help would be appreciated ? Pin
Richard MacCutchan14-Feb-19 1:35
protectorRichard MacCutchan14-Feb-19 1:35 
QuestionMongoDB Transactions Pin
Kevin Marois13-Feb-19 14:25
professionalKevin Marois13-Feb-19 14:25 
AnswerRe: MongoDB Transactions Pin
k505414-Feb-19 6:09
memberk505414-Feb-19 6:09 
QuestionC# MongoDB Question Pin
Kevin Marois10-Feb-19 7:58
professionalKevin Marois10-Feb-19 7:58 
AnswerRe: C# MongoDB Question Pin
k505412-Feb-19 6:07
memberk505412-Feb-19 6:07 
AnswerRe: C# MongoDB Question Pin
jschell23-Feb-19 11:11
memberjschell23-Feb-19 11:11 
QuestionSQLite how to delete rows in a table (C++) Pin
steve_94966138-Feb-19 5:08
professionalsteve_94966138-Feb-19 5:08 
AnswerRe: SQLite how to delete rows in a table (C++) Pin
k50548-Feb-19 7:21
memberk50548-Feb-19 7:21 
GeneralRe: SQLite how to delete rows in a table (C++) Pin
steve_949661310-Feb-19 21:30
professionalsteve_949661310-Feb-19 21:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.