Axon migration: Creating TokenEntry entries

Hi all,

I’m in the process of migrating an application from Axon 2 to 4.
Part of this I got aware that I need to create a TokenEntry table in the database.

I have created a migration-script based on the code in GenericTokenTableFactory.java (I haven’t found any documentation for this at all so it is wild guesses).
But the application still fails when it tries to query the table - likely because the table is empty.

`

2020-01-13 14:32:30,101 WARN [org.axonframework.eventhandling.TrackingEventProcessor] Fetch Segments for Processor ‘com.’ failed: org.hibernate.hql.internal.ast.QuerySyntaxException: TokenEntry is not mapped [SELECT te.segment FROM TokenEntry te WHERE te.processorName = :processorName ORDER BY te.segment ASC]. Preparing for retry in 2s
2020-01-13 14:32:30,101 WARN [org.axonframework.eventhandling.TrackingEventProcessor] Fetch Segments for Processor 'com.
’ failed: org.hibernate.hql.internal.ast.QuerySyntaxException: TokenEntry is not mapped [SELECT te.segment FROM TokenEntry te WHERE te.processorName = :processorName ORDER BY te.segment ASC]. Preparing for retry in 2s
2020-01-13 14:32:30,101 WARN [org.axonframework.eventhandling.TrackingEventProcessor] Fetch Segments for Processor ‘com.’ failed: org.hibernate.hql.internal.ast.QuerySyntaxException: TokenEntry is not mapped [SELECT te.segment FROM TokenEntry te WHERE te.processorName = :processorName ORDER BY te.segment ASC]. Preparing for retry in 2s
2020-01-13 14:32:30,101 WARN [org.axonframework.eventhandling.TrackingEventProcessor] Fetch Segments for Processor 'com.
’ failed: org.hibernate.hql.internal.ast.QuerySyntaxException: TokenEntry is not mapped [SELECT te.segment FROM TokenEntry te WHERE te.processorName = :processorName ORDER BY te.segment ASC]. Preparing for retry in 2s

`

Can anybody guide me in the direction of how these entries should look like? Are there any documentation on this?
I believe it is reasonable to set the entries in such a way that previous events isn’t send again.

Regards,
Theis

After further investigation is it clear now.

I will create an entry for each processorName with the tokens index set to the highest GlobalIndex that exist at that moment.
Regarding the errors-logs I mentioned was they unrelated and caused by the package with entity not being configured to be scanned by Hibernate:

localContainerEntityManagerFactoryBean.setPackagesToScan("org.axonframework.eventsourcing.eventstore.jpa", "org.axonframework.eventhandling.tokenstore.jpa");