diff --git a/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs b/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
index bb124bc7d17..700c318b150 100644
--- a/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
+++ b/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
@@ -668,6 +668,14 @@ public void ProjectionsTest()
Assert.AreEqual(7, array.Length);
+ ProjectionList pp1 = Projections.ProjectionList().Add(Projections.RowCountInt64());
+
+
+ object r = s.CreateCriteria(typeof(Enrolment))
+ .SetProjection(pp1)
+ .UniqueResult();
+ Assert.AreEqual(typeof (Int64), r.GetType());
+
IList list = s.CreateCriteria(typeof(Enrolment))
.CreateAlias("Student", "st")
.CreateAlias("Course", "co")
diff --git a/src/NHibernate/Criterion/Projections.cs b/src/NHibernate/Criterion/Projections.cs
index 541eead0c7c..887e9593122 100644
--- a/src/NHibernate/Criterion/Projections.cs
+++ b/src/NHibernate/Criterion/Projections.cs
@@ -42,12 +42,21 @@ public static ProjectionList ProjectionList()
///
/// The query row count, ie. count(*)
///
- ///
+ /// The RowCount projection mapped to an .
public static IProjection RowCount()
{
return new RowCountProjection();
}
+ ///
+ /// The query row count, ie. count(*)
+ ///
+ /// The RowCount projection mapped to an .
+ public static IProjection RowCountInt64()
+ {
+ return new RowCountInt64Projection();
+ }
+
///
/// A property value count
///
diff --git a/src/NHibernate/Criterion/RowCountInt64Projection.cs b/src/NHibernate/Criterion/RowCountInt64Projection.cs
new file mode 100644
index 00000000000..8ee552b5f00
--- /dev/null
+++ b/src/NHibernate/Criterion/RowCountInt64Projection.cs
@@ -0,0 +1,14 @@
+using System;
+using NHibernate.Type;
+
+namespace NHibernate.Criterion
+{
+ [Serializable]
+ public class RowCountInt64Projection : RowCountProjection
+ {
+ public override IType[] GetTypes(ICriteria criteria, ICriteriaQuery criteriaQuery)
+ {
+ return new IType[] { NHibernateUtil.Int64 };
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/NHibernate/NHibernate-2.0.csproj b/src/NHibernate/NHibernate-2.0.csproj
index d3ef789caf2..2b983f1233f 100644
--- a/src/NHibernate/NHibernate-2.0.csproj
+++ b/src/NHibernate/NHibernate-2.0.csproj
@@ -556,6 +556,7 @@
+