Rails Postgres String Operations Java