Wednesday, May 06, 2009

Transparent DataNucleus enhancement at run-time

Today it has worked! In the last days I was working to avoid the enhancement phase in the building of Roma Framework projects. Yes. Until yesterday you needed to invoke the "persistence-compile" task in your Roma project and all the projects that contained persistent classes.

Furthermore pre-packaged modules such as ADMIN, USERS, MESSAGING and SCHEDULER-QUARTZ needed to self-execute the enhancement in order to put persistence capable classes inside the JAR. This was a mess if you needed to change the ORM binding since anything resided inside the JAR.

I have to check yet if run-time changes to the entity POJOs are auto-enhanced at the fly... If works the productivity would be speedup over and over again.

Thanks to Andy Jefferson of DataNucleus team in supporting my crazy requestes :-) The work tomorrow will be in changing all the wizards to support the new configuration. In few words the change consist in:
  1. Let to the PersistenceAspect to invoke the Enhancer at startup
  2. Create the file persistence.xml inside the src/META-INF folder.
Once everything works I'll commit in to the SVN trunk for the upcoming release 2.0.


Chris the OO Junky said...

I'm trying to do the same thing. Do you have a sample of how to perform the runtime enhancement using the API?

Luca Garulli said...

At the end my patch wont work, sorry. But I don't work on that since that post.