嗨,我有一个带有 @entity 注释的简单 UserDetails 类,在我的休眠配置文件中,hbm2ddl 设置为创建,但运行时显示表 UserDetails 不存在。创建表后,它工作正常。为什么即使 hbm2ddl 设置为创建,休眠也不自动创建表?休眠.cfg.xml
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/shammu</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="cache.provider_class">org.hibernate.cache.NocacheProvider</property>
<property name="show_sql">true</property>
<property name="hibernate.hbm2ddl">create</property>
<mapping class="org.shammu.UserDetails" />
</session-factory>
</hibernate-configuration>