Buggy code:
@ Service ( "outsourcerService" ) @ Repository public class JPAOutsourcerService implements OutsourcerService { private EntityManager em ; @ PersistenceContext public void setEntityManager ( EntityManager em ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) public List < AssignmentClientDto > findAssigments ( Long id ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) public void copyAssigments ( PeticionOutsourcer peticionOutsourcer ) { } @ Transactional ( readOnly = true ) public Outsourcer buscarTecnicoPorNombre ( String nombre ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) private List < AssignmentClientDto > buscarEmpleadosOutsourcers ( Long idOutsourcer ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) public List < OutsourcerAssignment > buscarEmpleadosOutsourcers ( ) { } @ Transactional ( readOnly = true ) public Licencias obtenerLicencia ( Long id ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) public List < Client > findClients ( ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) public List < OutsourcerDto > buscarOutsourcers ( ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) public List < Peticiones > buscarPeticiones ( Long idOutsourcer ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) public List < PeticionOutsourcer > buscarPeticiones ( ) { } @ Transactional ( readOnly = true ) public PeticionOutsourcer buscarPeticion ( Long id ) { } @ Transactional ( readOnly = true ) @ SuppressWarnings ( "unchecked" ) public List < Outsourcer > buscarEmpleadosOutsourcers ( SearchCriteria criteria ) { String pattern = getSearchPattern ( criteria ) ; int startIndex = ( criteria . getPage ( ) ) * ( criteria . getPageSize ( ) ) ; <START_BUG> return em . createQuery ( "select<seq2seq4repair_space>h<seq2seq4repair_space>from<seq2seq4repair_space>Outsourcer<seq2seq4repair_space>h<seq2seq4repair_space>where<seq2seq4repair_space>lower(h.nombre)<seq2seq4repair_space>like<seq2seq4repair_space>:pattern<seq2seq4repair_space>or<seq2seq4repair_space>lower(h.proyecto)<seq2seq4repair_space>like<seq2seq4repair_space>:pattern<seq2seq4repair_space>" ) . setParameter ( "pattern" , pattern ) . setFirstResult ( startIndex ) . setMaxResults ( criteria . getPageSize ( ) ) . getResultList ( ) ; <END_BUG> } @ Transactional ( readOnly = true ) public Outsourcer buscarEmpleado ( Long id ) { } @ Transactional ( readOnly = true ) public Assignments createAsignement ( Long outsourcerID , String userName ) { } @ Transactional ( readOnly = true ) public Peticiones crearPeticion ( Long outsourcerID , String descripcion , String status ) { } @ Transactional ( readOnly = true ) public void crearPeticion ( Long outsourcerID , Date finicio , Date ffin , String comentario ) { } @ Transactional @ SuppressWarnings ( "unchecked" ) public void persistirPeticion ( Peticiones peticiones ) { } @ Transactional public void persistAssignments ( Assignments assignments ) { } @ Transactional public void cancelAssignments ( Long id ) { } @ Transactional public void revisionDePeticion ( Long id , String notas , String status ) { } private String getSearchPattern ( SearchCriteria criteria ) { } @ Transactional public UserMaster buscarUserMaster ( String username ) { } @ Transactional public void persistEntry ( Long id ) { } @ SuppressWarnings ( "unchecked" ) @ Transactional public List < Clock > seeClock ( Long id ) { } public List < PeticionOutsourcer > buscarPeticiones ( SearchCriteriaPeticiones searchCriteriaPeticiones ) { } private Date fechaActual ( ) { } No newline ; at end ; of file ; }

Fix:
return em . createQuery ( "select<seq2seq4repair_space>h<seq2seq4repair_space>from<seq2seq4repair_space>Outsourcer<seq2seq4repair_space>h<seq2seq4repair_space>where<seq2seq4repair_space>lower(h.nombre)<seq2seq4repair_space>like<seq2seq4repair_space>:pattern" ) . setParameter ( "pattern" , pattern ) . setFirstResult ( startIndex ) . setMaxResults ( criteria . getPageSize ( ) ) . getResultList ( ) ;