-
1. Re: How to specify sequence to use on version entities?
adamw Jun 7, 2008 1:47 PM (in response to talios)Hello,
yes, that's true, you can't configure it right now (without changing the code :) ). I suppose the only place to put the configuration of it is, as you write, in @VersionsTable or some other annotation that would take an @GeneratedValue annotation as a parameter.
But now I'm starting to wonder if the _versions_id field is
needed at all. The versions table is never queried using this field, and it isn't used as a foreign key. In fact, it's not used at all :). And for the primary key the original id of the entity + the revision number should be used. (I know that having composite primary keys isn't considered 'good practice', but this may be an exception :) ). What do you think?
--
Adam -
2. Re: How to specify sequence to use on version entities?
talios Jun 7, 2008 7:27 PM (in response to talios)Whilst the _versions_id may not be used by envers itself currently, one thing we liked with a global revision id was the potential ability to rollback the entire db to its state at revision X fairly easily.
i.e. for each versioned entity, restore the latest version earlier than global revision x.
This wouldn't happen often, or possibly ever, but the potential to do it might be handy. -
3. Re: How to specify sequence to use on version entities?
adamw Jun 8, 2008 4:46 AM (in response to talios)Hello,
interesting use case :) It would still be possible, though - the _versions_id field is something different than the _revision field. The second could be used to do what you described, the first isn't useful (I meant to use it before, but I my plans changed and the field stayed :) )
--
Adam -
4. Re: How to specify sequence to use on version entities?
talios Jun 8, 2008 5:08 AM (in response to talios)By all means remove _versions_id then ;-)
-
5. Re: How to specify sequence to use on version entities?
adamw Jun 9, 2008 5:48 AM (in response to talios)Hello,
removed in trunk :).
--
Adam -
6. Re: How to specify sequence to use on version entities?
adamw Jun 20, 2008 8:09 AM (in response to talios)Hello,
about "rolling back the entire DB" - is this some generic tool that you are developing? (and if yes, maybe could contribute? :) )
--
Adam -
7. Re: How to specify sequence to use on version entities?
chand0s Aug 26, 2008 3:37 AM (in response to talios)Hi
I see that you have removed _versions_id, but my envers 1.0.0 GA still creates sequence "hibernate_sequence". Was this change included into 1.0.0 GA or not? -
8. Re: How to specify sequence to use on version entities?
adamw Aug 26, 2008 10:12 AM (in response to talios)Hello,
yes, _versions_id is removed, but the _revision_info table still uses a hibernate sequence. To change it to some custom revision number generation (= id generation for that table), use an entity annotated with @RevisionEntity, without a listener. For details see: http://www.jboss.org/envers/revision_log.html.
Adam -
9. Re: How to specify sequence to use on version entities?
chand0s Aug 26, 2008 4:17 PM (in response to talios)Thank you, it works!