-2
私は次のようなセッションファクトリオブジェクトを作成しています:セッションファクトリのメソッドは、使用するデータベースをどこで定義しますか?
SessionFactory factory = new Configuration().configure().buildSessionFactory();
私は* .hbm.xmlファイルに言及したデータベースに言及しているどのクラス?
私は次のようなセッションファクトリオブジェクトを作成しています:セッションファクトリのメソッドは、使用するデータベースをどこで定義しますか?
SessionFactory factory = new Configuration().configure().buildSessionFactory();
私は* .hbm.xmlファイルに言及したデータベースに言及しているどのクラス?
使用するデータベースは、hibernate.cfg.xmlファイルで定義されています。このファイルでは、データベース接続の統計情報を定義したり、使用するクラスをマッピングしたりすることができます。ここでは、接続の統計情報の例:
hibernate.cfg.xmlのform this tutorial:ノートのも
<?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>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@127.0.0.1:1521:MKYONG</property>
<property name="hibernate.connection.username">mkyong</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.default_schema">MKYONG</property>
</session-factory>
</hibernate-configuration>
:Configuration - Hibernate Documentation
(注記:mkyongのスタッフが時々時代遅れすることができるが、その男のいまいましいです私の仕事は現時点では私が責任を負っている)