论坛首页 入门技术论坛

hibernate 中文参数乱码

浏览 2067 次
该帖已经被评为新手帖
作者 正文
   发表时间:2008-07-14  

hibernate 中文参数乱码hibernate里在sql语句中使用中文参数乱码的解决方案如下:
<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
<!-- 配置sessionFactory, 注意这里引入的包的不同  -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref local="dataSource" />
        </property>
        <property name="mappingResources">
            <list>
                <value>com/ihandy/airwap/beans/Hotflight.hbm.xml</value>
                <value>com/ihandy/airwap/beans/Area.hbm.xml</value>
                <value>com/ihandy/airwap/beans/AirAssociatorInfo.hbm.xml</value>
                <value>com/ihandy/airwap/beans/OrderDetail.hbm.xml</value>
                <value>com/ihandy/airwap/beans/OrderQuest.hbm.xml</value>
            </list>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.c3p0.minPoolSize">2</prop>
                <prop key="hibernate.c3p0.maxPoolSize">5</prop>
                <prop key="hibernate.c3p0.timeout">600</prop>
                <prop key="hibernate.c3p0.max_statement">200</prop>
                <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
            </props>
        </property>
    </bean>

论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics