Minor database query changes in java classes