1

I am working on a Google Web Toolkit application, and I use JPA for access to the datastore. I just found out that the following doesn't work:

Query q = manager.createQuery("select x from Question x where x.name=:name");
q.setParameter("name", "ト<br />");
q.getResultList();

This returns 0 results. But not using named parameters does work:

Query q = manager.createQuery("select x from Question x where x.name='ト<br />'");
q.getResultList();

This returns 2 results, which is correct. Perhaps it has to do with the kana symbol (ト), but it looks like a bug anyway. Has anyone experienced this as well, is it a known bug, or am i doing something wrong? I guess i could just avoid named parameters, but i rather not.

Edit: removed typo in example that wasn't present in my original code

4

2 回答 2

0

你试过这个:

q.setParameter("name", "ト<br />");

?

我猜你不需要参数名称中的“:”。

您可能想阅读此文档

于 2011-04-03T21:04:52.140 回答
0

problem is encoding for binding variable.

Check encoding configuration, this aspect could depend from datastore.

bye

于 2011-04-02T17:26:48.573 回答