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
Post a Comment