Я пытаюсь запустить простое приложение Hibernate, но я получаю эту ошибку:
org.hibernate.exception.SQLGrammarException: could not execute query
java.sql.SQLException: ORA-00942: table or view does not exist
Моя сущность:
package beans;
import javax.persistence.*;
@Entity
public class Idt {
@Id
private int id;
@Column(name="name")
private String name;
public Idt(){
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Моя таблица называется IDT у пользователя Hr.
CREATE TABLE "HR"."IDT"
(
"ID" NUMBER NOT NULL ENABLE,
"NAME" VARCHAR2(20 BYTE),
CONSTRAINT "IDT_PK" PRIMARY KEY ("ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" ENABLE
)
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
(
INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
)
TABLESPACE "USERS" ;
Hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521/xe</property>
<property name="connection.username">SYSTEM</property>
<property name="connection.password">19141914</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<mapping class="beans.Idt"/>
</session-factory>
</hibernate-configuration>
Я думаю, что это что-то с отображением сущности из-за SQLException:
java.sql.SQLException: ORA-00942: table or view does not exist