使用Hibernate配置更改max_allowed_packet属性 [英] Changing max_allowed_packet property with Hibernate configuration
本文介绍了使用Hibernate配置更改max_allowed_packet属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以使用Hibernate XML配置文件更改max_allowed_packet?
Is there a way to change max_allowed_packet with the Hibernate XML configuration file?
这是我对Hibernate的春季注射
This is my Spring injection for Hibernate
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
<property name="url"><value>jdbc:mysql://localhost:3306/surveysmart</value></property>
<property name="username"><value>root</value></property>
<property name="password"><value>xxx</value></property>
</bean>
<!-- Session Factory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration" />
<property name="packagesToScan" value="com.sdl.contacts.vo" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.current_session_context_class">org.hibernate.context.ThreadLocalSessionContext</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
推荐答案
max_allowed_packet
是mysql配置选项.您应该在mysql配置中进行设置.
max_allowed_packet
is a mysql configuration option. You should set it in your mysql configuration.
http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html
这篇关于使用Hibernate配置更改max_allowed_packet属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文