AliasToBean transformer doesn't work correctly with MultiQuery

Description

Using the following mapping

<class name="Entity">
<id name="Id">
<generator class="assigned" />
</id>
</class>

the following code causes ArgumentException: The value "1" is not of type "Entity" and cannot be used in this generic collection.

using (var s = OpenSession())
using (var t = s.BeginTransaction())
{
var futureResults = s.CreateCriteria<Entity>()
.SetResultTransformer(Transformers.RootEntity)
.Future<Entity>();

var futureResultsCount = s.CreateCriteria<Entity>()
.SetProjection(Projections.RowCount())
.FutureValue<Entity>();

//loading results
futureResults.ToArray();
}

Environment

None

Attachments

3

Activity

Show:

Alexander Kovtik 
June 14, 2009 at 7:11 AM

There are still issues in my test case , so I attached the new one. I hope it is last

Excuse my inattention please.

Alexander Kovtik 
June 13, 2009 at 7:11 AM

Sorry I provided wrong bug description and patch file initially. Here is fixed version.

The subject of the bug should be:

AliasToBean transformer doesn't work correctly with MultiQuery

and the description:

Using the mapping

<class name="Entity">
<id name="Id">
<generator class="assigned" />
</id>
</class>

the following code throws exception

using (var s = OpenSession())
using (var t = s.BeginTransaction())
{
IMultiQuery multiQuery = s.CreateMultiQuery()
.Add(s.CreateQuery("select entity.Id as EntityId from Entity entity")
.SetResultTransformer(Transformers.AliasToBean(typeof(EntityDTO))
)
);

multiQuery.List();
}

Alexander Kovtik 
June 13, 2009 at 6:28 AM

Test case is in attachment.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Who's Looking?

Open Who's Looking?
Created June 13, 2009 at 6:23 AM
Updated December 4, 2010 at 3:37 PM
Resolved August 6, 2010 at 3:29 PM
Who's Looking?