问题描述
我正在从Spring in Action学习spring 3.0。
I am learning spring 3.0 from Spring in Action.
在那里它讨论了在JpaTranactionManager中使用jpadialect的重要性
There it talks about importance of having jpadialect in JpaTranactionManager
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="jpaDialect" ref="jpaDialect" />
</bean>
<bean id="jpaDialect"
class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
然而,方言已经通过jpaVendorAdaptor在entityManagerFactory的声明中出现。
However the dialect is already present in declaration of entityManagerFactory via jpaVendorAdaptor.
<bean id="entityManagerFactory" class= "org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
</bean>
<bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="HSQL" />
<property name="showSql" value="true"/>
<property name="generateDdl" value="false"/>
<property name="databasePlatform"
value="org.hibernate.dialect.HSQLDialect" />
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource. DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:hsql://localhost/spitter/spitter" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
在JpaTranactionManager中使用方言是多余的吗?
Is the use of dialect in JpaTranactionManager redundant?
推荐答案
在 JpaTransactionManager
中使用 jpaDialect
对于 jpaVendorAdapter
config。他们的配置有不同的用途。
The use of jpaDialect
in JpaTransactionManager
is no redundant to jpaVendorAdapter
config. Their config have different purpose.
你可以参考有很好的解释。
You can refer this post with good explanation.
这篇关于为什么在JpaTransactionManager中使用jpadialect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!