handling query differently use built in java to sql methods