Select specific columns from table with JPA in java -




i want write query getting specific columns.using

entitymanager.createquery("select u.name department u").getresultlist(); 

however returns object not instance of declaring class. correct way specific column table in jpa.as provider using hibernate

it returns list of objects (it hard jpa guess types returning). luckily can give hint typedquery this

typedquery<string> query = em.createquery("select u.name department u",     string.class); list<string> departmentnames = query.getresultlist(); 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -