Erreur avec HQL QuerySyntaxException: unexpected token

J'ai une question pour les 3 tables avec HQL classe. Il y a quelques un-à-plusieurs relations.

Pas de problème avec ma base de données ou avec mes classes d'entité pour chaque..

J'ai un peu de classe hibernate DAO cette requête, tout le travail est bon, sauf celui-ci..

classe reportserviceimpl pour jasperreport,

Je suis d'erreur comme ceci

Exception in thread "AWT-EventQueue-0" org.mise en veille prolongée.hql.ast.QuerySyntaxException: unexpected token: ase près de la ligne 1, colonne 84 [select s.produit.nom que le nom du produit, somme(s).la quantité) la quantité, la s.de vente.noTable ase noTable, s.de vente.membre, s.prix comme le prix, la somme(s).sous-total) en tant que sous-total de restodeskapp.de modèle.SalesDetail s où s.de vente.id = :id group by s.produit.nom de la commande par s.produit.nom]
au org.mise en veille prolongée.hql.ast.QuerySyntaxException.convertir(QuerySyntaxException.java:31)
au org.mise en veille prolongée.hql.ast.QuerySyntaxException.convertir(QuerySyntaxException.java:24)
au org.mise en veille prolongée.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
au org.mise en veille prolongée.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:258)
au org.mise en veille prolongée.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
au org.mise en veille prolongée.hql.ast.QueryTranslatorImpl.compiler(QueryTranslatorImpl.java:111)
au org.mise en veille prolongée.moteur.de la requête.HQLQueryPlan.(HQLQueryPlan.java:77)
au org.mise en veille prolongée.moteur.de la requête.HQLQueryPlan.(HQLQueryPlan.java:56)

voici mon code pour HBL

List<SalesReport> salesReports =
        sessionFactory.getCurrentSession()
        .createQuery("select s.product.name as productName,"
        + " sum(s.quantity) as quantity,"
        + " s.sales.noTable as noTable,"
        + " s.sales.member as member,"
        + " s.price as price,"
        + " sum(s.subtotal) as subTotal from SalesDetail s "
        + " where s.sales.id = :id "
        + " group by s.product.name order by s.product.name")
        .setParameter("id", id)
        .setResultTransformer(
        Transformers.aliasToBean(SalesReport.class))
        .list();

ici mon Rapportventes

public class SalesReport {
    private String productName;
    private String member;
    private int noTable;
    private Long quantity;
    private BigDecimal subTotal;
    private BigDecimal price;
//setter getter
}

ici mes Ventes

public class Sales implements Serializable{

    @Id @GeneratedValue
    @Column(name="ID")
    private Long id;

    @Column(name="NO_TABLE", nullable=false)
    private int noTable;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name="SALES_DATE",nullable=false)
    private Date salesDate;

    @OneToMany(mappedBy="sales",cascade=CascadeType.ALL)
    @Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    private List<SalesDetail> salesDetails;

    @Column(name="TOTAL_SALES",precision=18,scale=0,nullable=false)
    private BigDecimal totalSales;

    @ManyToOne
    @JoinColumn(name="Member_ID")
    private Member member;
//setter getter
}

ici mon salesdetail

public class SalesDetail implements Serializable{

    @Id @GeneratedValue
    @Column(name="ID")
    private Long id;

    @ManyToOne
    @JoinColumn(name="PRODUCT_ID",nullable=false)
    private Product product;

    @Column(name="QUANTITY",nullable=false)
    private Integer quantity;

    @Column(name="PRICE",nullable=false,precision=18,scale=0)
    private BigDecimal price;

    @Column(name="SUBTOTAL",nullable=false,precision=18,scale=0)
    private BigDecimal subtotal = BigDecimal.ZERO;

    @ManyToOne
    @JoinColumn(name="SALES_ID",nullable=false)
    private Sales sales;
}

ici mon produit

public class Product implements Serializable {

    @Id @GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name="ID")
    private Long id;
    @Column(name="NAME",unique=true,length=200)
    private String name;
    @Column(name="DESCRIPTION",unique=false,length=500)
    private String description;
    @Column(name="PRICE",unique=false,length=200)
    private BigDecimal harga;
    @Column(name="note",unique=false,length=500)
    private String note;
    @Enumerated(EnumType.STRING)
    @Column(name="STATUS",length=20)
    private EnumStatus status;
    @Enumerated(EnumType.STRING)
    @Column(name="TYPE",length=20)
    private EnumJenisMakanan type;
    @Lob
    @Column(name="PICTURE")
    private byte[] picture;

}

Je vraiment ne sais pas whares le mal..
s'il vous plaît aider..

vous remercie..
Meilleur regard 🙂

InformationsquelleAutor Hallaz | 2013-05-26