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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:24:54+00:00 2026-05-20T11:24:54+00:00

Please help me on this problem. I have 2 identical tables, one is timetable

  • 0

Please help me on this problem.

I have 2 identical tables, one is timetable and another is timetable_bk. the 2 tables have similar properties or fields. Now I want to map 2 tables to one entity class (alltimetable).

I already tried Inheritance.TABLE_PER_CLASS strategy, but when I query using from AllTimetable. it return nothing.

Please help me. I search many times but did not get the answer yet.

Best Regards.

  • 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-20T11:24:55+00:00Added an answer on May 20, 2026 at 11:24 am

    To map two identical tables to one class you need to use the entity-name property of Hibernate or NHibernate. Documentation is here:

    http://docs.jboss.org/hibernate/core/3.2/reference/en/html/mapping.html#mapping-entityname

    For example, to map a single class Order to Order and OrderHistory tables you create a mapping file that maps the order class to the two tables using new entity-names like this:

    <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
     <class name="DomainModel.Order, DomainModel"
         table="Orders" entity-name="Order">`  
             <id name="_id" access="field" column="OrderId">
                 <generator class="assigned"/>
             </id>
            <property name= ...>
     </class>
     <class name="DomainModel.Order, DomainModel"
         table="OrderHistories" entity-name="OrderHistory">
             <id name="_id" access="field" column="OrderId">
                <generator class="assigned"/>
             </id>
            <property name= ...>
    </class>
    </hibernate-mapping>
    

    Then depending on which type of entity you need you call the appropriate session methods as:

    _session.Save("Order", myOrder) 
    

    or

    _session.Save("OrderHistory", myOrder)
    

    etc. In general entity-name must replace class name in all Hibernate calls.

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

Sidebar

Related Questions

I cannot understand how this is possible. Please help!! I have an app with
I've recently written this with help from SO. Now could someone please tell me
Here's my problem: I have 2 identical tables (past month data, current month data)
please help me this problem. I want to split -action=1 to action and 1.
I have a problem and I couldn't solve it.please help me. I have two
I'm helpless on regular expressions so please help me on this problem. Basically I
Please help me convert this line to C#. objManagementBaseObject.SetPropertyValue(hDefKey, CType(&H & Hex(RegistryHive.LocalMachine), Long)) Related
Hi Guys could you please help me refactor this so that it is sensibly
Hi Guys can you please help me with this error? What is it? Server
Maybe this cannot be done, but please help or suggest how this can be

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.