Passando uma lista como parametro, mas retornando o erro: The left parenthesis is missing from

A ideia é receber uma lista que contenha os nomes, e retornar uma lista que não tenha esses nome que está nessa lista recebida.

Então, o código é esse:

[code]public ArrayList findSelectedList(List lista) {

    ArrayList<String> layoutsSelecionados = new ArrayList<String>();
     EntityManager em = getEntityManager();
    String sql=  "select u.nome from Layoutsos u where u.nome not in = " + lista + "";
  
    
     layoutsSelecionados = (ArrayList<String>) em.createQuery(sql).getResultList();
    em.getTransaction().commit();
    
    return layoutsSelecionados ;
    
}[/code]

E esses erros aparecem:

[code]Exception Description: Syntax error parsing [select u.name from Layoutsos u where u.name not in = [Banner, Cartaz, Cartaz]]. [50, 50] The left parenthesis is missing from the IN expression. [77, 77] The right parenthesis is missing from the IN expression. at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1605)

Resolvi mudando a query: "select (u.nome)from Layoutsos u where u.nome not in:=("+lista+")";

mas esse erro apareceu:

Essa é a linha q ele mostra o erro:

miss click

Só ví agora.
Faz assim
"select u.nome from Layoutsos u where u.nome not in:=("+lista+")";

mas pense bem: Se o tamanho da sua lista crescer muito esse modo de construir sua SQL gera um custo muito alto. Há outros meios de fazer essa SQL ser menos custosa para o BD procure pelo “exists”.