I have a listener for AppContentStartedEvent
which invokes a bean which in turn simply publishes a custom event. The purpose of this is to, at app startup, create some data that is needed for a new instance of the app (if it doesn’t already exist). There are numerous listeners of this event, they all handle what’s needed for an entity.
My latest one needs to copy some master data from a shared/secondary datastore to the main one, if the main one is empty.
It seems that additional datastores are not available during this part of the app lifecycle, as all attempts to refer to the additional store via dataManager.*
operations produce a JPQL exception Abstract schema type unknown...
Access to the main store work just fine at this point in the lifecycle.
It’s not a persistence.xml
issue, as the additional store can be accessed just fine in the normal part of the app.
How can I solve this; at what point in the app cycle is that additional datastore available?