관리 메뉴

취미개발 블로그와 마음수양

hibernate.cfg.xml 본문

FrameWork_ETC/JPA_Hibernate

hibernate.cfg.xml

아라한사 2014. 10. 24. 20:39





<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.apache.derby.jdbc.ClientDriver</property>
<property name="connection.url">jdbc:derby://localhost:1527/HibernateDb;create=true</property>
<property name="connection.username">user</property>
<property name="connection.password">password</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- Enable Hibernate's current session context -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">create</property>
<mapping class="chap01.crud.Member" />
</session-factory>
</hibernate-configuration>

----------------------------------
H2Db
<property name="connection.driver_class">org.h2.Driver</property>
        <property name="connection.url">jdbc:h2:tcp://localhost/~/test;MVCC=true</property>
        <!--
        <property name="connection.url">jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;MVCC=TRUE</property>
        -->
        <property name="connection.username">sa</property>
        <property name="connection.password"/>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.H2Dialect</property>

mysql
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/데이터베이스이름</property>
<property name="hibernate.connection.username">id</property>
<property name="hibernate.connection.password">password</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>


HSQL
        <property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:mem:.</property>
<!-- <property name="connection.url">jdbc:hsqldb:hsql://localhost</property> -->
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>