org.javers.repository.sql.SqlRepositoryBuilder Java Examples
The following examples show how to use
org.javers.repository.sql.SqlRepositoryBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AuditableAspectConfiguration.java From cia with Apache License 2.0 | 6 votes |
/** * Gets the javers. * * @param txManager the tx manager * @return the javers */ @Bean public Javers getJavers(final PlatformTransactionManager txManager) { final JaversSqlRepository sqlRepository = SqlRepositoryBuilder.sqlRepository() .withConnectionProvider(new ConnectionProvider() { @Override public Connection getConnection() { final SessionImpl session = (SessionImpl) entityManager.unwrap(Session.class); return session.connection(); } }).withDialect(DialectName.POSTGRES).build(); return TransactionalJaversBuilder.javers().withTxManager(txManager) .withObjectAccessHook(new HibernateUnproxyObjectAccessHook()).registerJaversRepository(sqlRepository) .withMappingStyle(MappingStyle.BEAN).build(); }
Example #2
Source File: JaversSpringJpaApplicationConfig.java From javers with Apache License 2.0 | 6 votes |
/** * Creates JaVers instance with {@link JaversSqlRepository} */ @Bean public Javers javers(PlatformTransactionManager txManager) { JaversSqlRepository sqlRepository = SqlRepositoryBuilder .sqlRepository() .withConnectionProvider(jpaConnectionProvider()) .withDialect(DialectName.H2) .build(); return TransactionalJaversBuilder .javers() .withTxManager(txManager) .withObjectAccessHook(new HibernateUnproxyObjectAccessHook()) .registerJaversRepository(sqlRepository) .build(); }
Example #3
Source File: JaversSqlAutoConfiguration.java From javers with Apache License 2.0 | 5 votes |
@Bean(name = "JaversSqlRepositoryFromStarter") @ConditionalOnMissingBean public JaversSqlRepository javersSqlRepository(ConnectionProvider connectionProvider) { return SqlRepositoryBuilder .sqlRepository() .withSchema(javersSqlProperties.getSqlSchema()) .withConnectionProvider(connectionProvider) .withDialect(javersSqlDialectName()) .withSchemaManagementEnabled(javersSqlProperties.isSqlSchemaManagementEnabled()) .withGlobalIdCacheDisabled(javersSqlProperties.isSqlGlobalIdCacheDisabled()) .build(); }