org.javers.repository.sql.ConnectionProvider Java Examples
The following examples show how to use
org.javers.repository.sql.ConnectionProvider.
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: 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 #3
Source File: JaversSchemaManager.java From javers with Apache License 2.0 | 5 votes |
public JaversSchemaManager(Dialect dialect, FixedSchemaFactory schemaFactory, PolyJDBC polyJDBC, ConnectionProvider connectionProvider, TableNameProvider tableNameProvider) { super(tableNameProvider); this.dialect = dialect; this.schemaFactory = schemaFactory; this.polyJDBC = polyJDBC; this.connectionProvider = connectionProvider; }
Example #4
Source File: AuditContext.java From dolphin-platform with Apache License 2.0 | 4 votes |
public AuditContext(final ConnectionProvider connectionProvider, final String dialect, final String schema) { this(connectionProvider, convertToDialect(dialect), schema); }
Example #5
Source File: JaversSqlAutoConfiguration.java From javers with Apache License 2.0 | 4 votes |
@Bean(name = "JpaHibernateConnectionProvider") @ConditionalOnMissingBean public ConnectionProvider jpaConnectionProvider() { return new JpaHibernateConnectionProvider(); }
Example #6
Source File: JaversSpringJpaApplicationConfig.java From javers with Apache License 2.0 | 4 votes |
/** * Integrates {@link JaversSqlRepository} with Spring {@link JpaTransactionManager} */ @Bean public ConnectionProvider jpaConnectionProvider() { return new JpaHibernateConnectionProvider(); }
Example #7
Source File: HibernateConfig.java From javers with Apache License 2.0 | 4 votes |
/** * Integrates {@link JaversSqlRepository} with Spring {@link JpaTransactionManager} */ @Bean public ConnectionProvider jpaConnectionProvider() { return new JpaHibernateConnectionProvider(); }
Example #8
Source File: Session.java From javers with Apache License 2.0 | 4 votes |
Session(Dialect dialect, KeyGenerator keyGenerator, ConnectionProvider connectionProvider, String sessionName) { this.dialect = dialect; this.connectionProvider = connectionProvider; this.sessionName = sessionName; this.keyGenerator = keyGenerator; }
Example #9
Source File: PreparedStatementExecutor.java From javers with Apache License 2.0 | 4 votes |
PreparedStatementExecutor(ConnectionProvider connectionProvider, Query query) { this.rawSql = query.rawSQl(); this.queryName = query.name(); this.statement = wrapExceptionAndCall(() -> connectionProvider.getConnection().prepareStatement(this.rawSql)); }
Example #10
Source File: SessionFactory.java From javers with Apache License 2.0 | 4 votes |
public SessionFactory(DialectName dialectName, ConnectionProvider connectionProvider) { this.dialect = Dialects.fromName(dialectName); this.connectionProvider = connectionProvider; this.keyGenerator = dialect.getKeyGeneratorDefinition().createKeyGenerator(); }