Any way to configure "development" mode for DataNucleus to force it to reload class metadata?


ebenzacar@...
 

I'm working on a fairly large, slow startup legacy application in which I am slowly trying to integrate DataNucleus.  I am also leveraging JRebel, which allows me to modify most classes on the fly without having to restart the application everytime.  For most business oriented logic, this works great.

However, with the DN persistence classes, DN seem to load the metadata into a cache/singleton of some sorts, which prevents me from modifying/reloading a class on the fly, and forces me to stop the application server everytime and relaunch it.  I've sifted through the code and couldn't see anything to enable this, nor did I notice anything in the DataNucleus Metadata Properties so I'm trying to find if there is another mechanism I can use to clear the Metadata cache and have DN reload it on the fly.

Similarly, I would be happy with any process that allows me to modify the persistence class and re-enhance it without needing to restart the application everytime.

Thanks,

Eric


Andy
 
Edited

There is a MetaDataManager for each PMF. It loads metadata when it needs to. There is a method unloadMetaDataForClass to unload a class' metadata if needing to do so.
There is also a method on JDOPersistenceManagerFactory unmanageClass(String className) which will call the underlying MetaDataManager method as well as the associated StoreManager method. Added in DN 4.0.

You could also ask on Apache ISIS support (which uses DataNucleus) because Dan Haywood played around with a JRebel addon to do something related some time ago. No idea if he published it.


ebenzacar@...
 

Thanks for the tip.  I was looking for a `clearCache` or a `clearMetadata` method or something to that extent that I didn't notice the `unmanage/unload` methods.

I also found the plugin from Dan Haywood for Eclipse that he wrote a long time ago.  Am including the links here for future reference.
- https://www.danhaywood.com/2014/01/23/isis-integration-with-jrebel/
- https://github.com/danhaywood/isis-jrebel-plugin

I'm working with IntelliJ which has a different plugin architecture, and will have to look at this more carefully,  It will lead to many additional questions how to integrate DN with IJ more seamlessly, as currently the enhancement process must be run as a manual task each time a class is modified in IJ.  An IJ plugin that automatically triggers the enhancer for modified classes would be ideal.  

Thanks,

Eric