Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to map partitioned data using NHibernate

We have a scenario where active records are stored in one table and over time old records are archived. The table structures for the two tables - active and archive are exactly the same.

E.g DomainObject_Current : ID INT : Autoincrement Key Value INT TimeStamp

DomainObject_Archive ID INT Value INT Timestamp

On a weekly basis we move records over 30 days old to the archive table from the Current table. The ID (Primary Key) is unique across the two tables.

The application should be agnostic of whether the data is coming in from the Current table or the Archive table. What is the best way to map the DomainObject class in this scenario?

like image 242
Ak Lo Avatar asked Nov 19 '25 06:11

Ak Lo


1 Answers

You may try to use a view to collect two of the partitioned tables. And DomainObject map to this view.

like image 192
Mike Lue Avatar answered Nov 22 '25 04:11

Mike Lue