Select usando != com toplink

2 respostas
F

Oi pessoal.
To criando uma named query da seguinte forma

@NamedQuery(name = “countByNumSeller”, query = “SELECT count(f.numForm) from Form1 f where f.numSeller = :numSeller and f.numStatus != numStatus”)

Mas to recebendo o erro
Caused by: Exception [TOPLINK-8026] (Oracle TopLink Essentials - 2.0.1 (Build SNAPSHOT (12/17/2007))): oracle.toplink.essentials.exceptions.EJBQLException
Exception Description: Syntax error parsing the query [Form1.countByNumSeller: SELECT count(f.numForm) from Form1 f where f.numSeller = :numSeller and f.numStatus != :numStatus], line 1, column 85: unexpected char [!].
at oracle.toplink.essentials.exceptions.EJBQLException.unexpectedChar(EJBQLException.java:399)

O operador != não é valido no toplink? Como eu posso fazer para substituí-lo numa consulta que eu precise usar o ‘diferente’ ?
valeu!

2 Respostas

lcegatti

O sinal que vc deve usar para este caso é o do sql comum (<>) :

@NamedQuery(name = "countByNumSeller", query = "SELECT count(f.numForm) from Form1 f where f.numSeller = :numSeller and f.numStatus <> numStatus")

[]'s

F

putz, valeu
tinha esquecido desse sinal.

Criado 31 de outubro de 2008
Ultima resposta 31 de out. de 2008
Respostas 2
Participantes 2