Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7918235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:26:10+00:00 2026-06-03T15:26:10+00:00

I have some instances for reporting where executing sprocs is easier and simpler than

  • 0

I have some instances for reporting where executing sprocs is easier and simpler than complicated QueryOver statements.

I have a DTO, not an entity, that represents the data returned from the query and want to populate the results of the query into the DTO. I am using named queries and session.GetNamedQuery() to execute the query.

  1. Do I have to create mapping files for the DTO?
  2. If so, is is possible to let NHibernate/FluentNHibernate know that it should not create tables for the DTO? My units tests drop and create the schema using NH’s SchemaExport tool and don’t want to create tables for the DTO’s

Please note I don’t want to project a QueryOver/Linq query using Projections and AliasToBean – I need to execute the stored procedure.

Cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:26:12+00:00Added an answer on June 3, 2026 at 3:26 pm

    With CreateSQLQuery, the following would work without any mapping file. Maybe you can give it a try with named queries :

    public class YourDto
    {
        public int YourDtoId { get; set; }
        public string YourDtoTitle { get; set; }
    }
    

    then

    var result = yourNhSession
        .CreateSQLQuery("select yourColumn1 as YourDtoId, yourColumn2 as YourDtoTitle from YOUR_TABLE")
        .SetResultTransformer(Transformers.AliasToBean<YourDto>())
        .List<YourDto>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen some instances where people will say you have to use JS
I have some basic (stupid) questions about AWS EC2 instances or AMIs. I created
I have a MongoDocument X which has some instances of MongoEmbeddedDocument Y. I now
I have a datatable with data in it (customer addresses). In some instances, column
I am writing a reporting gem that will have some helpers to extract data
I have some code like this to find all instances of the template in
I have a class implementing a data structure storing Comparable objects. Some instances hold
I have a url containing the following: /somepath/morestuff/ohno%25foobar For some reason apache is reporting
I have some code that creates a Process instance and later starts it. There's
I have some code using a System.Transactions.TransactionScope , that creating a new instance of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.