This document explains the static weaving setup for JPA entities in the Fineract project.
Static weaving is a process that enhances JPA entities at build time to improve runtime performance. This is done using the org.eclipse.persistence.tools.weaving.jpa.StaticWeave which processes the compiled classes and applies the necessary bytecode transformations.
The static weaving is configured in static-weaving.gradle and applied to all Java projects that contain JPA entities.
- Compilation: Java source files are compiled to the standard classes directory (
build/classes/java/main). - Weaving: Weaving happens as last step of compileJava task, which outputs them to the standard classes directory (
build/classes/java/main).
- Add JPA entities to
src/main/java - Ensure there's a
persistence.xmlfile insrc/main/resources/jpa/static-weaving/module/[module-name]/ - The build will automatically detect and apply static weaving
If you encounter issues with static weaving:
- Check that the
persistence.xmlfile exists in the correct location - Verify that the output directories are being created correctly
- Check the build logs for any weaving-related errors