Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.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
Hibernate Java Netbeans休眠_Hibernate - Fatal编程技术网

Hibernate Java Netbeans休眠

Hibernate Java Netbeans休眠,hibernate,Hibernate,我一直在使用下面的youtube教程来学习如何创建和处理Java Netbeans Hibernate。我做的和视频中的一模一样,但最后还是犯了一些错误 错误消息: Unable to find matching navigation case with from-view-id '/index.xhtml' for action '#(data.addMember())' with outcome '#(data.addMember())' index.xhtml <?xml ver

我一直在使用下面的youtube教程来学习如何创建和处理Java Netbeans Hibernate。我做的和视频中的一模一样,但最后还是犯了一些错误

错误消息:

Unable to find matching navigation case with from-view-id '/index.xhtml' for action '#(data.addMember())' with outcome '#(data.addMember())'
index.xhtml

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:form>
            <h:commandButton value="Add User" action="#(data.addMember())"/>            
        </h:form>
    </h:body>
</html>
HibernateUtil.java

import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.SessionFactory;

public class HibernateUtil {

    private static final SessionFactory sessionFactory;

    static {
        try {
            // Create the SessionFactory from standard (hibernate.cfg.xml) 
            // config file.
            sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
        } catch (Throwable ex) {
            // Log the exception. 
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }
}
Members.java

public class Members {

    private int id;

    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;
    }
    private String name;

    public Members(String name) {
        this.name = name;
    }    
}
Members.hbm.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="com.Simon.Members" catalog="user" table="members">

      <id name="id" type="java.lang.Integer" column="id">
          <generator class="identity"/>
      </id>

      <property name="name" type="string" column="name"/>

  </class>
</hibernate-mapping>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
  <class name="com.Simon.Members" catalog="user" table="members">

      <id name="id" type="java.lang.Integer" column="id">
          <generator class="identity"/>
      </id>

      <property name="name" type="string" column="name"/>

  </class>
</hibernate-mapping>