How to map partitioned data using NHibernate

We have a scenario in which active records are stored in one table and old records are archived over time. Table structures for two tables - active and archive.

e.g. DomainObject_Current: ID INT: auto-increment key Value INT TimeStamp

DomainObject_Archive ID INT Value INT Timestamp

On a weekly basis, we transfer records for 30 days to the archive table from the current table. The identifier (primary key) is unique in two tables.

The application must be agnostic of whether the data comes from the current table or the Archive table. What is the best way to map a DomainObject class in this scenario?

+3
source share
1 answer

You can try to use a view to collect two partitioned tables. And DomainObject is mapped to this view.

+1
source

Source: https://habr.com/ru/post/1774596/


All Articles