Reputation: 5684
I am using ormlite for my application in android. I want to run a query with chinese string like
QueryBuilder<Hotel, Integer> qb = daoHotelObject.queryBuilder();
Where<Hotel,Integer> where=qb.where();
where.eq("hotel_name", pHotelName);
where.and();
where.between("hotel_avg_price", minRange,maxRange);
PreparedQuery<Hotel> pq = qb.prepare();
List<Hotel> serachListHotels = daoHotelObject.query(pq);
Where pHotelName
is a Chinese string but the serachListHotels
is empty.
Upvotes: 0
Views: 466
Reputation: 116908
This unit test works fine for me in ORMLite. It does something like the following:
TableUtils.createTable(connectionSource, Foo.class);
Dao<Foo, Object> dao = DaoManager.createDao(connectionSource, Foo.class);
Foo foo = new Foo();
String unicodeString = "上海";
foo.stuff = unicodeString;
assertEquals(1, dao.create(foo));
QueryBuilder<Foo, Object> qb = dao.queryBuilder();
qb.where().eq(Foo.STUFF_FIELD_NAME, unicodeString);
List<Foo> results = qb.query();
assertEquals(1, results.size());
assertEquals(unicodeString, results.get(0).stuff);
This seems to be working fine. Is there anything that you are doing differently?
Upvotes: 2