convert sql query to hibernate query to retun list of specific object -


i 'd convert query below hql return me list<article> because createsqlquery impossible , must convert result manually :
here sql query :

query query = getsessionfactory().getcurrentsession().createsqlquery(                  "select *                    article                    articleid in (select articleid                                        article_depot                                        depotid = "+depotid+")"               ); 

thank in advance

assuming have onetomany relation between article_depot , article (one depot contains multiple articles) if have been correctly mapped query :

query query = getsessionfactory().getcurrentsession().createquery("select d.article article_depot d d.depotid = :depotid"); query.setparameter("depotid", depotid); list<article> resultlist = query.getresultlist(); 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -