Hello, I'm trying to load 3 properties, from a table SideFrames.
(I have a class SideFrame also, mapped to the table.)
For this I created a class SideFrameDTO, with Id, Price, ArtNo.
I want to execute the query below and get an instance of SideFrameDTO.

But I get "NHibernate.MappingException: No persister for:
SideFrameDTO"
I believe because the DTO class is not mapped.

But, is it possible to do this (only 3 props for a smaller class)?

Thank you,
Dan

string query = @"select
        p.Id as {sideFrameDTO.Id},
        p.PricePerUnit as {sideFrameDTO.Price},
        p.ArticleNumber as {sideFrameDTO.ArtNo}
from SideFrames sf join Products p on p.Id = sf.SideFrameId
where sf.Size = :sizeID and sf.Material = :materialID";

IQuery sqlQuery = session.CreateSQLQuery( query )
                .AddEntity( "sideFrameDTO", typeof ( SideFrameDTO ) );

sqlQuery.SetParameter( "sizeID", SizeID );
sqlQuery.SetParameter( "materialID", MaterialID );


sqlQuery.SetMaxResults( 1 );
return sqlQuery.UniqueResult< SideFrameDTO >();
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to