使用JPA里怎么配置使运行时输出SQL语句
2个回答
2015-09-28
展开全部
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.
PropertyPlaceholderConfigurer"
p:locations-ref="locations"
p:order="1" />
<util:list id="locations">
PropertyPlaceholderConfigurer"
p:locations-ref="locations"
p:order="1" />
<util:list id="locations">
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
引用庆峰科技的回答:
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.
PropertyPlaceholderConfigurer"
p:locations-ref="locations"
p:order="1" />
<util:list id="locations">
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.
PropertyPlaceholderConfigurer"
p:locations-ref="locations"
p:order="1" />
<util:list id="locations">
展开全部
<bean id="jpaDialect" class="org.springframework.orm.jpa.vendor.HibernateJpaDialect" />
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="ds1" />
<property name="jpaDialect" ref="jpaDialect" />
<!-- 显示SQL语句配置 -->
<property name="jpaProperties">
<props>
<prop key="hibernate.max_fetch_depth">3</prop>
<prop key="hibernate.jdbc.fetch_size">18</prop>
<prop key="hibernate.jdbc.batch_size">10</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="javax.persistence.validation.mode">none</prop>
<prop key="hibernate.hbm2ddl.auto">none</prop>
</props>
</property>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="ds1" />
<property name="jpaDialect" ref="jpaDialect" />
<!-- 显示SQL语句配置 -->
<property name="jpaProperties">
<props>
<prop key="hibernate.max_fetch_depth">3</prop>
<prop key="hibernate.jdbc.fetch_size">18</prop>
<prop key="hibernate.jdbc.batch_size">10</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="javax.persistence.validation.mode">none</prop>
<prop key="hibernate.hbm2ddl.auto">none</prop>
</props>
</property>
</bean>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询