I have encountered a problem since one hour..take me as a beginner please..
The query is very simple :
public List<String> finArticleByfamille(String famille){
EntityManager em = getEntityManager();
Query qr= em.createQuery("SELECT a.libel FROM Article a WHERE a.famille_idfamille = '"+famille+"'");
return qr.getResultList();
}
also I have tried this :
public List<String> finArticleByfamille(String famille){
EntityManager em = getEntityManager();
Query qr= em.createQuery("SELECT a.libel FROM Article a WHERE a.familleIdfamille = '"+famille+"'");
return qr.getResultList();
}
“famille_idfamille” is a foreign key from the table “Famille”, see the screenshot:

the error comes from this call:
String famille=famille_produit_fact_direct.getSelectedItem().toString();
l_article=(Vector) ajc.finArticleByfamille(famille);
I get this Error :
Grave: null
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Error compiling the query [SELECT a.libel FROM Article a WHERE a.famille_idfamille = 'famille2'], line 1, column 38: unknown state or association field [famille_idfamille] of class [glob.entitys.Article].
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at javax.swing.SwingWorker.get(SwingWorker.java:602)
at glob.main$32.done(main.java:2068)
at javax.swing.SwingWorker$5.run(SwingWorker.java:737)
I respected the same name as the database, so why it does not work ?
(sorry for the french language)
@Tim Gage thank you, I just noticed something..
in my entity
glob.entitys.ArticleI have familleIdfamille as field :Familleit is another entity..then it is normal that he does not know
famille_idfamille?EDIT:
this comment its from the documentation :
Employee of the Database…
Then I put this:
and its worked;
it is logical that it does not work, because the
familleIdfamilleis an instance ofFamilleentity…