详解
Hibernate.cfg.xml
<hibernate-configuration>
<session-factory name="foo">
<property name="show_sql">true</property>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hbm2ddl.auto">create</property>
<mapping resource="cn/itcast/domain/User.hbm.xml" />
<mapping resource="cn/itcast/domain/Role.hbm.xml" />
<mapping resource="cn/itcast/domain/Department.hbm.xml"/>
</session-factory>
</hibernate-configuration>
@写一个javabean实体类,想通过hibernate.hbm.xml映射来创建表(只有数据库没有表报)了上面的错,这时在hibernate.cmg.xml需加上
<property name="hbm2ddl.auto">create</property>这句话,他必须要自动创建