...
- BBDD Module: Data Base HSQLDB (HyperSQL DataBase). Is a relational database engine written in Java. Can be found in the bundle of the folder, opennaas/core/hsqldb
- Persistence Module: Classes that provide the communication between the BBDD and the other application layers. This module implements the DAO pattern. Can be found in the folder opennaas/core/persistence. Through JPA specification and his implementation, OpenJPA, provides the mapping between business entities and relational tables.
- GenericRepository: interface that defines, through generics, the essential methods to access the DB (find, save, delete…).
- GenericJpaRepository: implements the interface GenericRepository and allows through the EntityManager access to DB.
- GenericOSGiJpaRepository: class that extends of GenericJpaRepository. It contains the mechanisms to get the EntityManager from the OSGi container.
- GenericRepository: interface that defines, through generics, the essential methods to access the DB (find, save, delete…).
...
- Resources Module: Inside the bundle, opennaas/core/resources, is defined the persistence through the persistence.xml file and the core.xml (blueprint) file. In them we can see:
- core.xml (blueprint): this file publish the datasource as a osgi service.
- DataSource: the bean with the DataSource and the configuration parameters of the DB.
- Service: the service that publish the DataSource in the OSGi container.
- persistence.xml: this file has the persistence units.
- The name of the persistence-unit. With From this name value the GenericOSGiJpaRepository obtains the EntityManager
- Tag Non JTA DataSource: In this parameter we can find the global JNDI. With the JNDI the non-jta accesses to the datasource. (The non-JTA resource pattern is generally used when dealing with a single resource in the absence of global transactions. The non-JTA resource pattern is typically used within the scope of a web application or an application client. The application controls the transaction with the data source with the EntityTransaction interface.)
- Classes to persist
- The name of the persistence-unit. With From this name value the GenericOSGiJpaRepository obtains the EntityManager
- core.xml (blueprint): this file publish the datasource as a osgi service.
The persisted entities must be annotated.