Hello,
I am working on a hibernate system, and I am trying to generate some views of the data to display to the user (some what like reports).
Now being a newby I have some problems in knowing what is the best aproach to generate a view of the data I have in the database.
When I say view I mean that you do not retrieve all the data from the a table, but a portion. For example following is the SQL of a view I would like to generate:
Code:
SELECT dbo.toydef.name, COUNT(0) AS [childreen]
FROM dbo.toy INNER JOIN
dbo.toydef ON dbo.toy.definition = dbo.toydef.id
GROUP BY dbo.toydef.name
As you can see in the above view I am joing the data from three two different tables. I am using the toydef table to retrieve the names of each toy, and I am using the toy table to see how many childreen are playing with a particular toy.
The output of this query in Microsoft Sql Server is something as follows:
Code:
name | childreen
----------------------------
car | 5
doll | 3
----------------------------
Now I tought whether I will have to create a pojo for each single view I have. This pojo woudl have two methods, one with toyname and the other one with ammount. Then the dao would return a list of these pojos.
Is this they way I have to go, or there would be a more simpler way. The reason I am asking this is because this would mean having to create a dao and pjo definition for each report I have to create.
thanks and regards,
kcorp