JavaEE 동면 프로젝트Hibernate 자동 데이터베이스 생성
그리고 MySQL을 데이터베이스로 사용하고 있습니다.
프로젝트를 처음 실행할 때 자동으로 데이터베이스가 생성되기를 원합니다.
이것은 내 hibernate.cnf.xml
: 나는 데이터베이스 InternetProject
가 생성 될 수있는 방법을
<?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="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/InternetProject</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="connection.pool_size">10</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="show_sql">true</property>
<mapping class="entities.Business" />
<mapping class="entities.Coupon" />
<mapping class="entities.User" />
<mapping class="entities.LastLogin" />
</session-factory>
</hibernate-configuration>
?
설정 파일에 따르면, 이미 그것을 할 수 있으며 내가 그것을 잘 모르는 것 같아요 .. 감사합니다 사전에 :)
감사합니다. 이것과' 업데이트 '의 차이점은 언제입니까? –
Billie
create는 새 스키마를 만들고 업데이트는 스키마를 찾고 업데이트를 수행합니다 – tesnik03
'udpate' 대신'create'를 사용할 수 있습니까, 아니면 둘 다 사용해야합니까? – Billie