I use the following amazon.com book review example to illustrate my question.
Code:
class Book {
private String titile;
private Author auther;
private String description;
//...
private Set<Review> reviews;
}
Code:
class Auther {
private String fullName;
//...
}
Code:
class Review {
private String comment;
private Short rating;
private Calendar postDate;
//...
}
Now, I need to retrieve a list of book by either searching or subject for view only. I only want to have the following information in the list.
title
auther's name
descrption
# of reviews
the average rating
the last review time
The above are the properties of a Book object or the properties of its child classes, Auther and Review, and some calculation results of properties.
My question is not about how to write the HQL. There are plenty such examples in the reference documentation. My question is how to wrap all these data into an object or I don't really need to care about it. No object type is explicit stated in the front end, on a JSP file. I have used a data transfer object for a single object properties case. Using a transfer object requests a Hibernate mapping: property -> table column. I can't see how a mapping can take place in this sample.
I have done an extended research, but haven't found any related information. Can someone point me the direction please?
Thanks.