Configuring @GeneratedValue Strategy for globalIndex in Axon Framework

Hi,

I’m using Axon Framework v4.11.2 and encountering an issue with Hibernate. The DomainEventEntry entity has a globalIndex field with the default @GeneratedValue strategy, which resolves to ‘AUTO’. However, my current Hibernate dialect defaults to using sequences, and I would prefer to use the ‘IDENTITY’ strategy instead.

Here’s the relevant field:

@Id
@GeneratedValue
@SuppressWarnings("unused")
private long globalIndex;

Is there a way to override the generation strategy and explicitly configure it to use @GeneratedValue(strategy = GenerationType.IDENTITY)?

Thanks,
Gijs

First and foremost, welcome to the forum, @Gijs! :wave:

Concerning your issue, you’re definitely not alone.
The @GeneratedValue annotation was added almost 10 years ago; things were different, so it didn’t cause much hazzle back then. Now though, it does.

AxonIQ has drafted some info about this here. Hope that helps you to proceed with your setup!

Great! This is exactly the answer I was hoping for.
Thanks for your quick reply!

1 Like