Date
1 - 8 of 8
Custom Value Generator is not working in 5.2
ponssaran@...
The Datanucleus Guide for Value Generator is old and does not correspond to 5.2 API
https://www.datanucleus.org/products/accessplatform_5_2/extensions/extensions.html#store_valuegenerator There is no such Class org.datanucleus.store.valuegenerator.AbstractValueGenerator The class that is available now is org.datanucleus.store.valuegenerator.AbstractGenerator The constructor of the class is also changed to public AbstractGenerator(StoreManager storeMgr, String name) After changing according to the current API when the application is started. The Map ValueGenerationManager.uniqueGeneratorsByName of RDBMSStoreManager is not having the custom value generator. In Datanucleus 5.0 this is working. Is it a bug or the way of providing Custom Value Generator is changed? Can you please help? |
|
Sure some classes have been refactored over the years, but then since people can't be bothered to "get involved" with open source then docs don't get updated sometimes.
As can be seen here, any plugin registered generators are loaded when "unique" is true. All built-in generators use the exact same API, so suggest that you use those for reference. |
|
ponssaran@...
Hi Andy,
Thanks for the reply. Following is the plugin.xml that we are using, it has unique=true. <?xml version="1.0"?>As I said earlier the same plugin.xml works fine in 5.0 After debugging, the link that you shared in the previous thread is where the bug is In the Constructor of RDBMSStoreManager the AbstractStoreManger constructor is called public RDBMSStoreManager(ClassLoaderResolver clr, PersistenceNucleusContext ctx, Map<String, Object> props) The AbstractStoreManger instantiates ValueGenerationManager before the nucleusContext is set in the constructor protected ValueGenerationManager valueGenerationMgr = new ValueGenerationManagerImpl(this); So in the constructor of ValueGenerationManagerImpl while loading the plugin there is always a NullPointerException (storeMgr.getNucleusContext() == null). Due to this the custom value generator is never added to uniqueGeneratorsByName map. try |
|
Right, so if that is important for you on 5.2 then please provide a Pull Request.
|
|
Hi Andy,
I don't have access to github.com. I have attached the files modified for this fix. Verified with our product it is working as expected. Modified files in 5.2 branch AbstractStoreManager.java ValueGenerationManagerImpl.java |
|
ponssaran@...
Hi Andy,
Will this be available in 5.2.x release? |
|
It will be available in GitHub when I have time to translate what you have changed into something applyable. It won't be "released" until the next release, and since the last one was not long ago, that means at least 3 months.
|
|
ponssaran@...
Hi Andy,
Pull Request created for this bug. https://github.com/datanucleus/datanucleus-core/pull/406 |
|