Case insensitive search does not work if we use Query and EntityManager #PL-5941

This commit is contained in:
Yuriy Artamonov 2015-09-09 12:12:08 +00:00
parent 1c0cce6f2d
commit e67404082b

View File

@ -14,10 +14,15 @@ import java.util.Collections;
import java.util.List;
import java.util.UUID;
/**
* @author krivopustov
* @version $Id$
*/
public class DataManagerTest extends CubaTestCase {
protected DataManager dataManager;
@Override
public void setUp() throws Exception {
super.setUp();
dataManager = AppBeans.get(DataManager.class);
@ -109,6 +114,22 @@ public class DataManagerTest extends CubaTestCase {
assertTrue(list.size() > 0);
}
public void testLoadListCaseInsensitiveLower() {
Server server = new Server();
server.setName("LocalHost");
server.setRunning(true);
DataManager dataManager = AppBeans.get(DataManager.NAME);
dataManager.commit(new CommitContext(Collections.<Entity>singleton(server)));
LoadContext<Server> loadContext = LoadContext.create(Server.class);
loadContext.setQueryString("select s from sys$Server s where s.name like :name")
.setParameter("name", "(?i)%localhost%");
List<Server> list = dataManager.loadList(loadContext);
assertTrue(list.size() > 0);
}
public void testUnexistingQueryParameters() throws Exception {
LoadContext<User> loadContext = LoadContext.create(User.class).setQuery(
LoadContext.createQuery("select u from sec$User u where u.login = :login").setParameter("name", "admin"));