Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

count rows in table using jpa and jpql

2633702Dec 21 2015 — edited Dec 21 2015

|

votefavorite

|

Hello experts,

i'm trying to develop a function that count number of rows with specific arguments: for example i want to count the number of dossier which the client is 'client a' i want to get it in a table the first case contain the name of client and the second contanint the number of dossier for example client a |5 client b |12 ....

|

result exple

       `Client  |  Count    Row1:  A  5   Row2:  B  6    .....`

i wrote this function in my sessionbean

public List<Object[]> countrow(){ Query query= em.createQuery("SELECT d.client,COUNT(d.client) FROM Dossier d group by d.client "); return query.getResultList(); }

when i drag and drop it from the datacontrol i get an empty list...

Capture.PNG

i'm using jdevoper 12.1.3 and jpa2.0

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 18 2016
Added on Dec 21 2015
1 comment
1,339 views