Do anyboby know OR mappers or OR generator with there query language, that support versioning of objects? Seems like it's a quite popular thing, I've done that at least twice. However, as all homegrown solutions, it have lack of artitecture, features, support and ideas. Do anybody know any usefull solutions? I think, like Hibernate.

I'm talking about following examples:

Order

The example show changes of Order name and total count or ordered items:

id, version, status, currencyId,name, totalCount

10001, 1, active, 1002, "Order 32", 6, ...
10001, 2, editing, 1002, "IN PROCESS:Order 32", 7, ...
10001, 3, pending_approval, 1002, "IN PROCESS:Order 32", 8, ...
10001, 4, active, 1002, "Order 32", 8, ...


Currency

The example show change of currency name over versions:

id, version, status, ..., name, ...
1002, 1, active, 1002, ..., "$",...
1002, 2, editing, 1002, ..., "Dollar",...
1002, 3, pending_approval, ..., "US Dollar",...
1002, 4, pending_approval, ..., "USD",...
1002, 4, active, ..., "UDS",...


I want to write Queries like:

select orders.id, orders.name, ccy.name from Order orders (LATEST, ACTIVE), Currency ccy (LATEST,ACTIVE) where orders.currencyId = ccy.name

and tool should translate it to real query, with filter by status, MAX(version) and so on.