Sunday, 15 January 2012

java - avoiding multiple selects when using kew word "new" in hql -



java - avoiding multiple selects when using kew word "new" in hql -

i have next code in java.

list<userhelper> users=list<userhelper>)session.getnamedquery("pkuser.loadhelperusers").list();,

i think not matter "userhelper" class that's why not write it, not overload question. namedquery mentioned above.

@namedquery(name = "pkuser.loadhelperusers", query = "select new ge.tec.pto.ext.helpers.userhelper(u) pkuser u order u.pkuserid desc"),

the problem hql selects many rows, think same number of rows in database in pk_user table.if knows how prepare please inform me. nice if solution not require alter "namedquery", graet if have alter query creation, solutions helpful, give thanks you

multiple selects when using key word “`new`” in `hql` there no problem code , new keyword .

your query return rows in userhelper related table

you should utilize clause required rows .

ex :

query = "select new ge.tec.pto.ext.helpers.userhelper(u) pkuser u username=:passedparamer order u.pkuserid desc"

java hibernate select hql named-query

No comments:

Post a Comment