Ongres exercises - Gianluca Cannata
Exercise #1 - Bug hunter
In the first exercise I first applied a DISTINCT statement on film titles to avoid duplicates but it was somehow incorrect because it discarded those records with different categories.
I then applied an aggregate function STRING_AGG over film categories and grouped by film title to collect all categories in one column.
I tried to use the Collector interface from Java but it was difficult, error-prone e more verbose resulting in less clear code.
Exercise #2 - Document and refactor
I refactored and documented ResultSetIterator with a small improvement when dealing with its resources. I used a Cleaner and its Cleanable action to close all resources when the ResultSetIterator becomes phantom reachable.
Gianluca