In my database I have 2 Project Entities in different schemas, so I need to change default name to "myschema.Project", but When I try to create a NamedQuery in Entity class, eclipse IDE show me following error:
"'myschema.Project p' cannot be the first declaration of the FROM clause."
My code is
import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
@Entity(name="myschema.Project")
@Table(name="TB_PROJECT", schema = "MYSCHEMA")
@NamedQueries({
@NamedQuery(name="myNamedQuery", query=" SELECT count(p) "
+ " FROM myschema.Project p "
+ " WHERE p.personId = :personId ")
})
public class Project implements Serializable {
@Column(name="PERSON_ID")
private String personId;
}
Aucun commentaire:
Enregistrer un commentaire