Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

There are multiple ways in OpenHub how to store custom business data.

See following variants:

Table of Contents
maxLevel2

a) Adding tables to the OpenHub schema

...

  1. Add custom JPA entities
  2. Extend OpenHub database scheme with new objects (tables, sequences ...) . Directly in project database, flyway in OpenHub can be used as well. (https://flywaydb.org/)
  3. Configure EntityManager, to scan custom packages, with OpenHub configuration property ohf.jpa.additional-packages
    Example: 

    Code Block
    ohf.jpa.additional-packages=org.openhubframework.openhub.ri.persistence


  4. Entity manager bean can be used for building custom dao, or configure repositories using spring-data-jpa.

...

  • straightforward setup, except that OpenHubDatasource is Primary bean, so project has to work with Qualified dataSource.
  • For example JdbcTemplate can be used that way, other frameworks build on top if, or entirelly wrapped service (not exposing beans to spring context).

c) Add second datasource, with global transaction (one transactionManager)

  • SpringBoot autoconfiguration can be levered, either setup with JTA (Atomikos, Bitronix) or provided by application server.
  • Project specific dataSource, entityManagerFactory (and entityManager) can be configured, to have two separate JPA contexts.
  • Different databases can be configured for each JPA context as well. 

...