Hibernate HQL俄语字母

时间:2015-11-10 16:36:38

标签: java hibernate postgresql

当我尝试在hql中使用俄语字母时,我不会返回任何内容

ArrayList<Route> result=(ArrayList<Route>)session.createQuery("select distinct r" +
            " from StationAssignment sa " +
            " join sa.route r" +
            " join sa.station s" +
            " where lower( s.title)='москва' or lower( s.title)='саратов'" +
            " group by r" +
            " having count(r)=2").list();

日志:

  

Hibernate:选择不同的route1_.id为id1_3_,route1_.Title为   Title2_3_来自StationAssignment stationass0_ inner join Route route1_   on stationass0_.route_id = route1_.id inner join station station2_ on   stationass0_.Station_id = station2_.id在哪里   lower(station2_.Title)='РјРѕСЃРєРІР°'或   route(station2_.Title)='сараС,РѕРІ'group by route1_.id   计数(route1_.id)= 2

hibernate cfg

<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
        <property name="hibernate.connection.url" >jdbc:postgresql://vm12467.hv8.ru/dbname</property>

        <property name="hibernate.connection.CharSet">utf8</property>
        <property name="hibernate.connection.characterEncoding">utf8</property>
        <property name="hibernate.connection.useUnicode">true</property>

我在IDEA utf-8中的编码 如果我尝试这样做

ArrayList<Route> result=(ArrayList<Route>)session.createQuery("select distinct r" +
            " from StationAssignment sa " +
            " join sa.route r" +
            " join sa.station s" +
            " where lower( s.title)=:name1 or lower( s.title)=:name2" +
            " group by r" +
            " having count(r)=2").
            setParameter("name1",startStationName.toLowerCase()).
            setParameter("name2",endStationName.toLowerCase()).list();

我有一些东西

0 个答案:

没有答案