I am trying to use Hibernate QBE (in fact, Spring HibernateTemplate.findByExample ()) to return a list of users by their username. I use the "known good" value to search (username "JOHN.SMITH" exists in the database).
Unfortunately, I am not getting any results. Below is the unit test.
@Test public void testQueryByExample() { User qbeUser = new User(); qbeUser.setUsername("JOHN.SMITH"); List<User> userList = userDao.queryByExample(qbeUser); Assert.notNull(userList); Assert.isTrue(userList.size() > 0, "List of returned users must not be 0"); }
The queryByExample () method is defined in the general DAO:
@SuppressWarnings("unchecked") public List<T> queryByExample(T obj) { return getHibernateTemplate().findByExample(obj); }
Is there any special configuration required for QBE to work?
source share