Hibernate envers bumping rev for new entity

I am using spring boot with spring data jpa. I have a user entity with an id field and firstname and lastname field. I have annotated the entity with the @Audited annotation. I am using Spring’s CrudRepository to perform CRUD operations.
When I start my application the User_AUD table is created fine. However when I create a new User entity, my understanding is that in the AUD table the ver column should have value 1 for every new entity created and then subsequent updates should bump the value by 1. But in my case the rev column is being incremented even when I am creating a new user entity.
What am I missing?

Every transaction creates a new revision. And the revision number is used to mark when the insert, update or delete hapenned.

For more details, check out the User Guide.

By every transaction you mean every transaction to the same entity right? But for a different entity it should start with 1. Let me give an example about what’s happening in my case.

User [id: 1, firstname: ‘Mark’, lastname: ‘Roberts’] // create
User_AUD [id: 1, rev: 1, revtype: 0, firstname: ‘Mark’, lastname: ‘Roberts’]

User [id: 2, firstname: ‘James’, lastname: ‘Pattison’] // create
User_AUD [id: 2, rev: 2, revtype: 0, firstname: ‘James’, lastname: ‘Pattison’]
Shouldn’t the rev in the second entity be 1?

No. By transaction I mean successive JPA transactions. There is just one counter for revision.

Ah OK, I see. Thanks for the reply. At least that’s the expected behaviour then.

You’re very welcome.