java ee - How can I make this sql query with jpa ? -


i'm trying create query in entities.

i have these following tables in mysql db :

 categorie : id, nom ...   article : num_code_barre_, categorie ...   

in entity categorie :

...  @id @generatedvalue(strategy = generationtype.identity) @basic(optional = false) @column(name = "id") private integer id; @size(max = 30) @column(name = "nom") private string nom;  ... 

in entity article :

...  @id @basic(optional = false) @notnull @size(min = 1, max = 50) @column(name = "num_code_barre_") private string numcodebarre; @basic(optional = false) @notnull @column(name = "categorie") private int categorie;  ... 

i have tested sql query in db, it's work :

select c.nom , count(a.numcodebarre)  categorie c inner join article on c.id =        a.categorie group a.categorie 

but when try create namedquery in categorie entity receive error in output: "synthax error parsing query ..."

@namedquery(name = "categorie.count", query = "select c.nom , count(a.numcodebarre)  categorie c inner join article on c.id = a.categorie group a.categorie") 

someone have idea how can ?

"on" not part of jpql clauses in jpa 1.0 or jpa 2.0. introduced in jpa 2.1 , doubt you're using that, since not released


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -