Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
由以下原因导致的休眠:java.sql.SQLException:ORA-00942:表或视图不存在_Java_Oracle_Hibernate - Fatal编程技术网

由以下原因导致的休眠:java.sql.SQLException:ORA-00942:表或视图不存在

由以下原因导致的休眠:java.sql.SQLException:ORA-00942:表或视图不存在,java,oracle,hibernate,Java,Oracle,Hibernate,实体: 实体经理: package Model; import java.io.Serializable; import javax.persistence.*; @Entity @Table( name="Eredmenyek", schema = "H_C26G18" ) public class Eredmenyek implements Serializable{ @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(na

实体:

实体经理:

package Model;
import java.io.Serializable;
import javax.persistence.*;

@Entity
@Table( name="Eredmenyek", schema = "H_C26G18" )
public class Eredmenyek implements Serializable{

@Id @GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="ID")
private int id;

@Column( name="JATEKOS1" )
private String Játékos1;

@Column( name="JATEKOS2" )
private String Játékos2;

@Column( name="NYERTES" )
int nyertes;


public Eredmenyek(String Játékos1, String Játékos2, int nyertes) {
    this.Játékos1 = Játékos1;
    this.Játékos2 = Játékos2;
    this.nyertes = nyertes;
}

public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

public String getJátékos1() {
    return Játékos1;
}

public void setJátékos1(String Játékos1) {
    this.Játékos1 = Játékos1;
}

public String getJátékos2() {
    return Játékos2;
}

public void setJátékos2(String Játékos2) {
    this.Játékos2 = Játékos2;
}

public int getNyertes() {
    return nyertes;
}

public void setNyertes(int nyertes) {
    this.nyertes = nyertes;
}
}
将创建数据库表和列: 模式:H_C26G18 表名:Eredmenyek 列:ID、JATEKOS1、JATEKOS2、NYERTES

我使用netbeans和连接到数据库的Service/Database/OraleThin->。(这似乎是正确的,因为我创建了表)

我试着只在一张小桌子上读写一些,但我尝试的每件事都会给我错误。这个错误我不知道怎么解决。我看到了所有的值名称,我想我没有拼错它


有人能告诉我是什么问题,为什么?(这个帮助很快就需要我了:/)

在persistence.xml中,我将validate更改为update似乎:

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1768)
....

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
... 47 more
Caused by: javax.persistence.PersistenceException:
org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerIml.java:1692) 
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:492)
at Model.EredményekImpl.olvasEredmény(EredményekImpl.java:46)
at Game.FXMLController_Ranglista.listázás(FXMLController_Ranglista.java:47)
... 57 more
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
...
... 59 more
Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
...
... 75 more

我运行我的程序,它为我创建了表格

问题在于kordirko所写的内容:我使用名为“Eredmenyek”的命令创建了表和列,但是(数据库没有显示这一点)数据库喜欢使用大写字母创建它。在这之后,如果我试着用大写字母“EREDMENYEK”或“EREDMENYEK”或其他任何东西,没有什么是好的

在创建完表格后,我将其设置为“验证”:

<property name="hibernate.hbm2ddl.auto" value="update"/>


尝试输入persistence.xml。这将在EntityManager的init上获得错误消息,并提供更好的信息。原因:javax.persistence.PersistenceException:[PersistenceUnit:db]无法构建Hibernate SessionFactory原因:org.Hibernate.tool.schema.spi.SchemaManagementException:架构验证:缺少表[Eredmenyek]您是否可以针对
H\u C26G18
schema
SELECT*FROM user\u tables,其中table\u name='Eredmenyek'
?此查询是否返回非空结果?可能是创建表时名称周围没有大括号,在本例中,Oracle将名称中的所有字母转换为大写
EREDMENYEK
,原因是:javax.persistence.PersistenceException:[PersistenceUnit:db]无法生成Hibernate SessionFactory,原因是:org.Hibernate.tool.schema.spi.SchemaManagementException:架构验证:再次缺少表[Eredmenyek]:/我用命令创建了表。在数据库中,名称看起来像Eredmenyek,但列看起来像NYERTES,例如,但我尝试了。(我将编辑我的注释)当我尝试:SELECT*FROM user_tables,其中table_name='Eredmenyek'或'Eredmenyek':由:javax.persistence.PersistenceException:[PersistenceUnit:db]引起无法生成Hibernate SessionFactory,原因是:org.Hibernate.tool.schema.spi.SchemaManagementException:架构验证:缺少表[EREDMENYEK]
<?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="Model.Eredmenyek" schema="H_C26G18" table="Eredmenyek">
  <id name="id" type="int" column="ID">
     <generator class="increment"/>
  </id>
  <property name="Játékos1" column="JATEKOS1" type="string"/>
  <property name="Játékos2" column="JATEKOS2" type="string"/>
  <property name="nyertes" column="NYERTES" type="int"/>
</class>
</hibernate-mapping>
@FXML
private void listázás(ActionEvent event) {

    listáz.setText("Megnyomtad");
    EredményekImpl a = new EredményekImpl();
    List<Eredmenyek> e = a.olvasEredmény();
    String h = new String();

    System.out.println(e);
    System.out.println("Hello");

    for( Eredmenyek i : e ){
        if( i.getNyertes() == 1 )
            h += i.getJátékos1() + " " + i.getJátékos2()+ "\n";
        else
            h += i.getJátékos2() + " " + i.getJátékos1() +"\n";
    }

    lista.setText(h);
}
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1768)
....

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
... 47 more
Caused by: javax.persistence.PersistenceException:
org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerIml.java:1692) 
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1602)
at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:492)
at Model.EredményekImpl.olvasEredmény(EredményekImpl.java:46)
at Game.FXMLController_Ranglista.listázás(FXMLController_Ranglista.java:47)
... 57 more
Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:63)
...
... 59 more
Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)
...
... 75 more
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.hbm2ddl.auto" value="validate"/>