Persistence classes scanning
Eclipse Link
Control Loop runtime uses persistence.xml
file: is the deployment descriptor file for persistence using JPA. It specifies the persistence units and declares the managed persistence classes, the object/relation mapping, and the database connection details.
Hibernate
SpringBoot auto-configuration can automatically scan entity classes. In Control Loop Runtime we can use @EntityScan annotation because entity classes are not placed in the main application package or its sub-packages. In this situation, we need declare the package or list of packages in the main configuration class within @EntityScan annotation.
............................. @EntityScan({"org.onap.policy.models.tosca.simple.concepts", "org.onap.policy.clamp.controlloop.models.controlloop.persistence.concepts"}) public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
Implication using Hibernate and SpringBoot scan
persistence.xml
file doesn't contain all JPA classes in "org.onap.policy.models.tosca.simple.concepts" package, so SpringBoot will intercept additional classes (not defined into persistence.xml
file) and will generate additional tables into controlloop database for them: ToscaEventFilter, ToscaModel, ToscaServiceTemplates, ToscaServiceTemplates_ToscaServiceTemplate, ToscaTimeInterval, ToscaTrigger.
Schema generation
to be continued