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 4023668
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:37:36+00:00 2026-05-20T10:37:36+00:00

I have entity fluently mapped to existing oracle view: public class MyEntityMap : ClassMap<MyEntity>

  • 0

I have entity fluently mapped to existing oracle view:

public class MyEntityMap : ClassMap<MyEntity>
{
    public class MyEntityMap()
    {
        ReadOnly();
        SchemaAction.None();
        //mappings
    }
}

I’m querying oracle view for entities and filtering them based on certain criteria, let’s say, where created_date more than 14 days. Those entities should be written into the database for future reporting use. For that purpose I’ve created a table which is exact clone of oracle view in terms of fields. And I’d like to map exactly the same MyEntity to my own table. Something like that:

public class MyHistoricalEntityMap : ClassMap<MyEntity>
{
    public class MyHistoricalEntityMap()
    {
        Table("HistoricalEntities");
        //mappings
    }
}

Also, I have a service responsible for querying view, but I want to add a method to store my historical entities, smth like below:

public class MyEntityService : IMyEntityService
{
    private IRepository<MyEntity> _repository;
    ...    
    public IEnumerable<MyEntity> GetEntities(){...}    
    public void StoreHistoricalEntities(IEnumerable<MyEntity> historicalEntities) {...}
}

So, question is: how do I specify, that I want to (or nhibernate should) use MyEntityMap for querying, but MyHistoricalEntityMap for storing results? Or what other solution can I apply?

Thanks,

  • 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-05-20T10:37:37+00:00Added an answer on May 20, 2026 at 10:37 am

    You can’t use two different mappings for an entity.

    What you can do is use custom SQL for loading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have: @Entity public class Order { @Id private int id; @OneToMany(mappedBy=order)
I have entity class generated by E-R designer that I have modified a little.
I have entity Problem mapped using many-to-many to entity Tag (Problem has a list
I have an entity with a surrogate Id and a composite NaturalId mapped with
i have an entity that contains two other entities with @ManyToOne relationship. @Entity public
I have an Entity (Article) with an Class defined at xcdatamodel. In this class
I have a problem with entity versioning. Here's what I want to archive: Let's
I have a database, and I have entity POCO's, and all I want to
I am using entity framework with a web service and I have entity partial
I'm working on my first real MVC application and I'm trying to follow general

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.