currently, the data is not joined, so if you read versioned entities, you only get the data that is versioned. I admit that joining with the original entity to have the immutable business key makes sense. If it doesn't change, making it versioned only wastes space. One problem I see here, is what would happen if you delete the entity? You would still be able to read the history, but you wouldn't be able to get the business key.
what would happen if you delete the entity? You would still be able to read the history, but you wouldn't be able to get the business key.
In my case, I won't ever delete it, or if I do it really was a mistake to enter it.
In a more general case I suppose that the designer should understand that, as he didn't version some data, it won't be possible to
1)get an older version (seems obvious)
2)get it as it was before deletion (is a logic consequence of point 1)
IMHO it is quite accepatble, if it isn't they should version all data.
yeah, if you delete the entity you can't expect to have the full data :) There are several options on turning on the possibility to join the historic entity with the "current" entity. One is an switch when creating queries - but then, you wouldn't get the joining when doing find() or traversing relations. The other is a global configuration option (to turn it on or off for all entities). The third is an annotation on the entity, for example "@JoinWithCurrent" (or just on some fields?). What do you think?
The deleted entities would pose still some problems in the general case, when selecting entities, but I think a left join should be enough to solve it :)
Anyway, please create a jira feature request :)
thank you very much for sharing your thoughts, but I don't have all this experience on your project to really follow the implications of these changes;
I appreciate your explanations however.
What I think is that if someone is using @Versioned on an entity he would expect to find the entity in history, but in these cases as only a property is begin "@versioned" you shouldn't be able to retrieve an older version of the entity, but should be able to get the state of versioned property.
So couldn't this all be made transparent to the user (developer using Envers)?
here is the JIRA: https://jira.jboss.org/jira/browse/ENVERS-59
thanks for letting me open it; I will send a testcase next week, I'm sorry I am too busy this one.
a test case would be great :)
So you would expect to:
- be able to specify restrictions on non-versioned properties in queries
- when reading a versioned entity, to have all non-versioned fields filled with "current" data, unless the entity is deleted.
Did I understand correctly?
yes, I think that makes sense.
Maybe when I'll send the testcase it will appear more clear why this is very useful.
I guess it will be mainly useful in the presence of an immutable business key.