2

I want to delete a list of items and I defined the following query for the Entity Email:

@NamedQuery(name = Email.namedQueryDeleteOldEmails, query = "DELETE FROM Email e where e.creationDate <= :creationDate")

When I execute it, I have the following error: 2012-10-26 12:45:25,570 ERROR [SGVISTA] org.hibernate.hql.internal.ast.ErrorCounter - line 1:1: unexpected token: Email line 1:1: unexpected token: Email

Does anybody know what is wrong with my query? Thank you very much

aika
  • 73
  • 1
  • 1
  • 6
  • you are missing double quotes around the name of the NamedQuery, is that just a typo? name = "Email.namedQueryDeleteOldEmails" – Karen Butzke Oct 27 '12 at 10:38

1 Answers1

0

@NamedQuery(name ="Email.namedQueryDeleteOldEmails", query = "DELETE FROM Email e where e.creationDate <= :creationDate")

use the named name inside double quotes it will work

muthukumar
  • 2,233
  • 3
  • 23
  • 30