how to fetch data from database using id in java