org.javers.repository.sql.JaversSqlRepository Java Examples
The following examples show how to use
org.javers.repository.sql.JaversSqlRepository.
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(); }
Example #4
Source File: JaversSqlAutoConfiguration.java From javers with Apache License 2.0 | 5 votes |
@Bean(name = "JaversFromStarter") @ConditionalOnMissingBean public Javers javers(JaversSqlRepository sqlRepository, PlatformTransactionManager transactionManager) { return TransactionalJaversBuilder .javers() .withTxManager(transactionManager) .registerJaversRepository(sqlRepository) .withObjectAccessHook(javersSqlProperties.createObjectAccessHookInstance()) .withProperties(javersSqlProperties) .build(); }
Example #5
Source File: TransactionalJaversBuilder.java From javers with Apache License 2.0 | 5 votes |
@Override public Javers build() { if (txManager == null) { throw new JaversException(JaversExceptionCode.TRANSACTION_MANAGER_NOT_SET); } Javers javersCore = super.assembleJaversInstance(); Javers javersTransactional = new JaversTransactionalDecorator(javersCore, getContainerComponent(JaversSqlRepository.class), txManager); return javersTransactional; }
Example #6
Source File: JaversTransactionalDecorator.java From javers with Apache License 2.0 | 4 votes |
JaversTransactionalDecorator(Javers delegate, JaversSqlRepository javersSqlRepository, PlatformTransactionManager txManager) { Validate.argumentsAreNotNull(delegate, javersSqlRepository, txManager); this.delegate = delegate; this.javersSqlRepository = javersSqlRepository; this.txManager = txManager; }