2
這是相關的部分從我的context.xml文件:如何在我的context.xml配置hibernate.dialect
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="packagesToScan" value="com.netomedia.model"/>
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
</props>
</property>
<!-- <property name="persistenceUnitName" value="punit"/> -->
<property name="dataSource" ref="dataSource"/>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
</property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="MYSQL"/>
<!-- <property name="databasePlatform" value="${hibernate.dialect}"/> -->
<property name="showSql" value="false"/>
<property name="generateDdl" value="false"/>
<!-- <property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect"/> -->
<!-- <property name="hibernate.connection.autocommit" value="false"/> -->
</bean>
</property>
<property name="jpaPropertyMap">
<map>
<entry key="hibernate.connection.autocommit" value="false" />
</map>
</property>
我想知道這是否是配置Hibernate的正確方法.dialect和它們之間有什麼區別:
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
或
<property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect"/>
謝謝!
謝謝!我應該刪除 org.hibernate.dialect.MySQL5Dialect ? –
lior
沒必要.. – user3020494