JPQL: la ruta del campo de estado no se puede resolver en un tipo válido
No puedo hacer que esta consulta funcione:
Query query = eManager.createQuery("select c FROM News c WHERE c.NEWSID = :id",News.class);
return (News)query.setParameter("id", newsId).getSingleResult();
y obtuve esta excepción:
Exception Description: Problem compiling [select c FROM News c WHERE c.NEWSID = :id].
[27, 35] The state field path 'c.NEWSID' cannot be resolved to a valid type.] with root cause
Local Exception Stack:
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.0.v20130507-3faac2b): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [select c FROM News c WHERE c.NEWSID = :id].
¿Por que sucede? : id y parámetro con nombre son idénticos
EDITAR: mi clase de entidad
@Entity
@Table(name="NEWS")
public class News implements Serializable{
@Id
@SequenceGenerator(name = "news_seq_gen", sequenceName = "news_seq")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "news_seq_gen")
private int newsId;
private String newsTitle;
private String newsBrief;
private String newsContent;
private Date newsDate;
@Transient
private boolean selected=false;
//constructor and getters and setters