So, I have a repository method that is supposed to return an ArrayList. The ResultSet I get from the database returns correctly but the ArrayList only populates with the same record 4 times. I have 4 records in my database.
Here's my code:
I was returning a set before but I changed it to an ArrayList while I was experimenting with what was wrong.
Don't return null. If anything goes wrong, either return the List in its present state (size=0) or let the exception propagate, or throw a different (preferably chained) exception.
I presume lines 35‑37 are only there for debugging purposes. That code will always work because the add() method always works and will always return true.