I need to retrieve results and put fname and lname as single values of name column, how can I do that?
ProjectionList pl = Projections.projectionList();
pl.add(Projections.property("user.id").as("id"));
pl.add(Projections.property("user.fname").as("fname"));
pl.add(Projections.property("user.lname").as("lname"));
Current output
id fname lname
17 Alex Moore
34 Jack Segal
Output should be
id name
17 Alex Moore
34 Jack Segal
System.out.println(user.getFirstName() + " " + user.getLastName()). Your database queries shouldn't mess with pure presentation logic.