Postgres Max Function In Java