如果不存在则不自动创建Schema如何解决,如果存在数据库名称意味着表是自动创建但架构不存在意味着在运行时不创建架构怎么办.
休眠属性
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
hibernate.hbm2ddl.auto=create-update ** i use these keyword seperately also //create or//update**
**xml configuration**
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.testing.domain" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
</prop>
</props>
</property>
</bean>
最佳答案 在代码中使用它,它会删除当前架构并创建一个新架构.
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto.create-drop}</prop>