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.
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:
Then depending on which type of entity you need you call the appropriate session methods as:
or
etc. In general entity-name must replace class name in all Hibernate calls.