4.3.4. Persistence
| 4.3. Services |

### 4.3.4. Persistence

Persistence is one of key technical services injected into the services container. This service, as well as other major services in Orchestra, is based on a service interface. That means that multiple persistence implementations can be plugged on top.

The Persistence service interface is responsible to save and load objects from a relational database. By default, a persistence implementation based on the Hibernate ORM framework is provided (JPA and JCR to come).

The Process Virtual Machine core definition and execution elements (processes, nodes, transitions, events, actions, variables and executions) as well as the BPEL extension ones (activities, conditions, variables...) are persisted through this service. Process Virtual Machine core elements are also cached by leveraging the default persistence service implementation (Hibernate based). Processes and instances are stored through this persistence service. Repository is the term used in Orchestra to store those entities.

This service is only used if the repository service is set to database.

#### 4.3.4.1. Database Access Configuration

The default configuration of Orchestra uses the Database persistence service and the H2 Database. Orchestra has also been tested with Oracle, MySQL and Postgres database system. To change to mysql, postgres or Oracle, you need to install the corresponding JDBC driver (see Chapter 3, Installation guide) and modify the `hibernate.properties` file : uncomment the corresponding lines :

      # Hibernate configuration

      # For using Orchestra with H2
      # hibernate.dialect                      org.hibernate.dialect.H2Dialect
      # hibernate.connection.driver_class      org.h2.Driver
      # hibernate.connection.url               jdbc:h2:file:db_orchestra
      # hibernate.connection.username          sa
      # hibernate.connection.password

      # For using Orchestra with postgreSQL
      # hibernate.dialect                      org.hibernate.dialect.PostgreSQLDialect
      # hibernate.connection.driver_class      org.postgresql.Driver
      # hibernate.connection.url               jdbc:postgresql://server:port/db
      # hibernate.connection.username          user
      # hibernate.connection.password          pass

      # For using Orchestra with MySQL
      # hibernate.dialect                      org.hibernate.dialect.MySQL5InnoDBDialect
      # hibernate.connection.driver_class      com.mysql.jdbc.Driver
      # hibernate.connection.url               jdbc:mysql://server:port/db
      # hibernate.connection.username          user
      # hibernate.connection.password          pass

      hibernate.dialect                      org.hibernate.dialect.H2Dialect
      hibernate.connection.driver_class      org.h2.Driver
      hibernate.connection.url               jdbc:h2:file:db_orchestra
      hibernate.connection.username          sa
      hibernate.connection.password

      hibernate.hbm2ddl.auto                 update
      hibernate.cache.use_second_level_cache true
      hibernate.cache.provider_class         org.hibernate.cache.HashtableCacheProvider
      hibernate.show_sql                     false
      hibernate.format_sql                   false
      hibernate.use_sql_comments             false
      hibernate.bytecode.use_reflection_optimizer true

4.3.3. Repository |  | 4.3.5. Journal and History