Is it possible to map result of SQL to not flat object?
List<Customer> customers = hibernateSession().createCriteria(CustomerDetailsView.class)
.add(Restrictions.in("userName", userName))
.setProjection(buildProjection())
.setResultTransformer(Transformers.aliasToBean(Customer.class))
.list();
In my case CustomerDetailsView has flat structure. But I need to map it to object like this:
public class Customer {
private String userName;
private String title;
private String firstName;
private String lastName;
private String type;
private String companyName;
private AddressDetails addressDetails;
}
and
public class AddressDetails {
private String countryCode;
private String addressLine1;
private String zipOrPostCode;
private String city;
private String countryDivisionName;
private String countryDivisionCode;
private String countryDivisionTypeCode;
private String residentialAddress;
}