Hibernate version: 1.2.0 GA
Database: Microsoft SQL Server 2000
I have this query/stored procedure
Code:
SELECT Files.pkFileGuid,
COUNT(Views.ViewDate) AS Total,
(SELECT COUNT(*) FROM Views WHERE ViewDate < CONVERT(varchar, GETDATE(), 112)) AS Today
FROM Files
INNER JOIN Views ON Files.pkFileGuid = Views.fkFileGuid
GROUP BY Files.pkFileGuid
HAVING pkFileGuid = @Guid
I want to map this accordingly, like:
Code:
// Hibernate mapping for the File class...
<component name="Views" class="View" insert="false" update="false">
<property name="Total" type="Int32" />
<property name="Today" type="Int32" />
</component>
I've tried to use formulas but I can't seem to send in the ID contained in the class. Anyone have a good suggestion on how to solve this?
My apologies if my English is bad... Do comment. :)