-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Session's get() retrieves question marks instead of greek
PostPosted: Wed May 04, 2011 7:51 am 
Newbie

Joined: Tue Dec 21, 2010 9:43 am
Posts: 8
I have a web application that uses spring and hibernate. My hibernate session factory is configured in spring as:

Code:
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
        <property name="dataSource" ref="myDataSource" />
        <property name="configurationClass">
            <value>org.hibernate.cfg.AnnotationConfiguration</value>
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.show_sql">true</prop>
                <prop key="hibernate.dialect">org.hibernate.dialect.SQLServer2005Dialect</prop>
                <prop key="hibernate.cache.use_query_cache">false</prop>
                <prop key="hibernate.cache.use_second_level_cache">false</prop>
            </props>
        </property>
        <property name="packagesToScan">
            <list>
                <value>com.example.dslibweb.model</value>
            </list>
        </property>

    </bean>


The data source as:

Code:
<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="${jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
        <property name="maxActive" value="${jdbc.maxConnections}" />
    </bean>


and the properties file for the data source is:

Code:
jdbc.username=sa
jdbc.password=***
jdbc.url=jdbc:sqlserver://10.62.0.105:1433;databaseName=example;useUnicode=true;characterEncoding=utf-8
jdbc.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.maxConnections=-1


I have a call:

Code:
DsActions action = (DsActions) this.hibernateCriteriaCommons.findById(id, new DsActions());


and findById is defined as:

Code:
public T findById(String id, Object model) {
        return (T) this.sessionFactory.getCurrentSession().get(model.getClass(), id);
    }


So I am calling the get method of hibernate session for a specific id and I expect an instance of type DsActions.

All works well when I run it from a local Tomcat instance (run through netbeans).

When I install it on a remote tomcat server, the instance of DsActions seems to have an encoding issue. When retriveing a field of DsActions instance I get question marks (??? ?????? ??????). The text is supposed to be greek characters

I am very confused, I do not understand why in the first case it is working and not in the second.
Note: the data is retrieved by the same database server, so no difference there. The only difference is the machine where the application is running.

Thank you all in advance.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.