package com.mpalourdio.hello.model;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.Collection;
import java.util.List;

/**
 * This implementation MUST have the 'impl'
 * suffix in order to be discovered !
 */

public class TaskRepositoryImpl implements CustomRepository<Task> {
    @PersistenceContext
    private EntityManager entityManager;

    @Override
    @SuppressWarnings("unchecked")
    public List<Task> customFindByPriority(final String priority) {
        return this.
                entityManager.
                createQuery("select e from Task e where e.taskPriority = '" + priority + "'").
                getResultList();
    }

    static <T> void fromArrayToCollection(final T[] a, final Collection<T> c) {
        for (final T o : a) {
            c.add(o); // compile-time error
        }
    }
}

@@ -327,16 +327,17 @@
 Task%3E %7B%0A
+%0A
     @Per
@@ -530,30 +530,8 @@
 urn 
-this.%0A                
 enti
@@ -539,17 +539,16 @@
 yManager
-.
 %0A       
@@ -556,16 +556,17 @@
         
+.
 createQu
@@ -618,29 +618,23 @@
 y = 
-'%22 + p
+:taskP
 riority
- + %22'
 %22)
-.
 %0A   
@@ -650,195 +650,81 @@
     
-getResultList();%0A    %7D%0A%0A    static %3CT%3E void fromArrayToCollection(final T%5B%5D a, final Collection%3CT%3E c) %7B%0A        for (final T o : a) %7B%0A            c.add(o); // compile-time error%0A        %7D
+.setParameter(%22taskPriority%22, priority)%0A                .getResultList();
 %0A   

Use parameterized query