Search code examples
javaoracle-databaseoracle-adfjdeveloper

Get the count of an object


I have a view object, the result of the following query:

SELECT TEACHER_ID_FK, 
       MATERIAL_ID_FK, 
       CREATION_DATE, 
       VALID_BEFORE 
FROM TEACHER_MATERIAL;

In my application module I have this line of code to get hold of the view object.

TeachMaterVVOImpl voTeachMater = (TeachMaterVVOImpl)this.getTeachMaterVVO1();

Now I got a materialId(of type MATERIAL_ID_FK) in my hand.

How to get the number of count of this materialId from this view object?


Solution

  • I did it in the following way:

    1. Get the View Object
    2. Iterate over it in a loop
    3. Get the material IDs
    4. Get the count of each material ID
    5. Group them by the count and ID in a map
    6. Get the count from the map by the ID at hand

    And it worked super fine.