こんにちは、EJB 3 を使用しており、DB から単純なリストを取得しようとしていますが、「travauxdereseauurbain がマップされていません [travauxdereseauurbain Tr から Tr を選択]」というメッセージが表示され、意味がわかりません。
エンティティはこちら
package com.pfe.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.soap.Text;
@Entity
@Table(name="travauxdereseauurbain")
public class Traveauxdereseauurbain implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name="idtru")
private int idtru;
@Column(name = "article")
private String article;
@Column (name="designationtraveau")
private String designationtraveau;
@Column(name="unite")
private String unite;
@Column(name="prixHTVA")
private float prixHTVA;
@Column(name="prixTTC")
private float prixTTC;
@Column (name="qtt")
private float qtt;
@Column(name="montantHTVA")
private float montantHTVA;
@Column(name="montantTTC")
private float montantTTC;
public int getIdtru() {
return idtru;
}
public void setIdtru(int idtru) {
this.idtru = idtru;
}
public String getArticle() {
return article;
}
public void setArticle(String article) {
this.article = article;
}
public String getDesignationtraveau() {
return designationtraveau;
}
public void setDesignationtraveau(String designationtraveau) {
this.designationtraveau = designationtraveau;
}
public String getUnite() {
return unite;
}
public void setUnite(String unite) {
this.unite = unite;
}
public float getPrixHTVA() {
return prixHTVA;
}
public void setPrixHTVA(float prixHTVA) {
this.prixHTVA = prixHTVA;
}
public float getPrixTTC() {
return prixTTC;
}
public void setPrixTTC(float prixTTC) {
this.prixTTC = prixTTC;
}
public float getQtt() {
return qtt;
}
public void setQtt(float qtt) {
this.qtt = qtt;
}
public float getMontantHTVA() {
return montantHTVA;
}
public void setMontantHTVA(float montantHTVA) {
this.montantHTVA = montantHTVA;
}
public float getMontantTTC() {
return montantTTC;
}
public void setMontantTTC(float montantTTC) {
this.montantTTC = montantTTC;
}
public Traveauxdereseauurbain(int idtru, String article,
String designationtraveau, String unite, float prixHTVA, float prixTTC,
float qtt, float montantHTVA, float montantTTC) {
super();
this.idtru = idtru;
this.article = article;
this.designationtraveau = designationtraveau;
this.unite = unite;
this.prixHTVA = prixHTVA;
this.prixTTC = prixTTC;
this.qtt = qtt;
this.montantHTVA = montantHTVA;
this.montantTTC = montantTTC;
}
public Traveauxdereseauurbain() {
super();
}
}
`
そしてDAOクラス
package com.pfe.data;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import com.pfe.controller.travauxdereseauurbainBean;
import com.pfe.model.Traveauxdereseauurbain;
import com.pfe.model.Traveauxdereseauurbain;
@Stateless
public class TravauxdereseauurbainDAO {
@PersistenceContext
private EntityManager em;
public void AddTravauxdereseauurbainDAO (Traveauxdereseauurbain Trurbain)
{
em.persist(Trurbain);
}
public Traveauxdereseauurbain affichernimpr()
{
Query q =em.createNamedQuery("select tr from travauxdereseauurbain tr");
return (Traveauxdereseauurbain) q.getResultList().get(0);
}
}
`
そして、私はこのエラーを受け取りました:
原因: javax.ejb.EJBException: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: travauxdereseauurbain がマップされていません [travauxdereseauurbain Tr から Tr を選択]