Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public <T extends AbstractDictionaryN> List<T> getLikeThis(Class type, String subString) {
- try {
- String jpql = "select d from " + type.getCanonicalName() + " d where d.name like :sub";
- return entityManager.createQuery(jpql)
- // .setParameter("table", type.getCanonicalName())
- .setParameter("sub", "%" + subString + "%")
- .getResultList();
- } catch (QueryException | ClassCastException e) {
- e.printStackTrace();
- return new ArrayList<>();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment