开发者

How can I query all past versions of an object with eclipselink?

开发者 https://www.devze.com 2023-01-31 05:56 出处:网络
Well, by means of historical session, we can query an object at a specific time. But what I need is to query all the versions of that object..

Well, by means of historical session, we can query an object at a specific time. But what I need is to query all the versions of that object..

The documentation points out that we can not do this.. But is there anyone that cust开发者_如何转开发omize eclipselink for this behaviour?..

edit : well, this question has been asked at eclipselink forums. It seems that nobody interested in this question.

EDIT : I have requested an enhancement request. If you want this enhancement, please vote.. Here is the link : https://bugs.eclipse.org/bugs/show_bug.cgi?id=333725


Here is the answer from eclipselink forum ..

There does not seem to be an easy way to do this. Please log an enhancement request and vote for it.

You can use a native SQL query for this. You will need to set "eclipselink.maintain-cache"="true" on the query.

You could also map a separate class to the historical table, and include the start and end date in the object, and the startDate as part of the Id. This is really what you would want to do, as querying the original class will not give you access to the start and end dates. You could use a MappedSuperclass and have the current and historical class subclass it and use the different tables.

0

精彩评论

暂无评论...
验证码 换一张
取 消