org.springframework.orm.jpa.vendor.Database Java Examples

The following examples show how to use org.springframework.orm.jpa.vendor.Database. 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: JpaTargetManagement.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
public JpaTargetManagement(final EntityManager entityManager, final QuotaManagement quotaManagement,
        final TargetRepository targetRepository, final TargetMetadataRepository targetMetadataRepository,
        final RolloutGroupRepository rolloutGroupRepository,
        final DistributionSetRepository distributionSetRepository,
        final TargetFilterQueryRepository targetFilterQueryRepository,
        final TargetTagRepository targetTagRepository, final NoCountPagingRepository criteriaNoCountDao,
        final EventPublisherHolder eventPublisherHolder, final TenantAware tenantAware,
        final AfterTransactionCommitExecutor afterCommit, final VirtualPropertyReplacer virtualPropertyReplacer,
        final Database database) {
    this.entityManager = entityManager;
    this.quotaManagement = quotaManagement;
    this.targetRepository = targetRepository;
    this.targetMetadataRepository = targetMetadataRepository;
    this.rolloutGroupRepository = rolloutGroupRepository;
    this.distributionSetRepository = distributionSetRepository;
    this.targetFilterQueryRepository = targetFilterQueryRepository;
    this.targetTagRepository = targetTagRepository;
    this.criteriaNoCountDao = criteriaNoCountDao;
    this.eventPublisherHolder = eventPublisherHolder;
    this.tenantAware = tenantAware;
    this.afterCommit = afterCommit;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.database = database;
}
 
Example #2
Source File: DaoSpringModuleConfig.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the Hibernate JPA vendor adapter needed by the entity manager.
 *
 * @return the Hibernate JPA vendor adapter.
 */
private JpaVendorAdapter getHibernateJpaVendorAdapter()
{
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    // Set the database type.
    String databaseType = configurationHelper.getProperty(ConfigurationValue.DATABASE_TYPE);
    if (StringUtils.isBlank(databaseType))
    {
        throw new IllegalStateException(
            String.format("No database type found. Ensure the \"%s\" configuration entry is configured.", ConfigurationValue.DATABASE_TYPE.getKey()));
    }
    Database database = Database.valueOf(databaseType);
    LOGGER.info("jpaTargetDatabase={}", database);
    hibernateJpaVendorAdapter.setDatabase(database);
    hibernateJpaVendorAdapter.setGenerateDdl(false);
    return hibernateJpaVendorAdapter;
}
 
Example #3
Source File: JpaInfrastructureConfig.java    From spring-content with Apache License 2.0 6 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

	HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
	vendorAdapter.setDatabase(Database.HSQL);
	vendorAdapter.setGenerateDdl(true);

	LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
	factory.setJpaVendorAdapter(vendorAdapter);
	factory.setPackagesToScan(packagesToScan());
	factory.setPersistenceUnitName("spring-data-rest-webmvc");
	factory.setDataSource(dataSource());
	factory.afterPropertiesSet();

	return factory;
}
 
Example #4
Source File: JPAUtil.java    From genericdao with Artistic License 2.0 6 votes vote down vote up
/**
 * 获取数据库类型
 */
public static Database getDBType(DataSource dataSource){
	String jdbcUrl = getJdbcUrlFromDataSource(dataSource);
	
	if (StringUtils.contains(jdbcUrl, ":h2:")) {
		return Database.H2 ;
	} else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
		return Database.MYSQL ;
	} else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
		return Database.ORACLE ;
	} else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
		return Database.POSTGRESQL ;
	} else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
		return Database.SQL_SERVER ;
	}
	throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
}
 
Example #5
Source File: RSQLUtilityTest.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void correctRsqlBuildsLikePredicateWithPercentageSQLServer() {
    reset(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
    final String correctRsql = "name==a%";
    when(baseSoftwareModuleRootMock.get("name")).thenReturn(baseSoftwareModuleRootMock);
    when(baseSoftwareModuleRootMock.getJavaType()).thenReturn((Class) SoftwareModule.class);
    when(criteriaBuilderMock.upper(eq(pathOfString(baseSoftwareModuleRootMock))))
            .thenReturn(pathOfString(baseSoftwareModuleRootMock));
    when(criteriaBuilderMock.like(any(Expression.class), anyString(), eq('\\'))).thenReturn(mock(Predicate.class));
    when(criteriaBuilderMock.<String> greaterThanOrEqualTo(any(Expression.class), any(String.class)))
            .thenReturn(mock(Predicate.class));

    // test
    RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null, Database.SQL_SERVER)
            .toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);

    // verification
    verify(criteriaBuilderMock, times(1)).and(any(Predicate.class));
    verify(criteriaBuilderMock, times(1)).like(eq(pathOfString(baseSoftwareModuleRootMock)),
            eq("a[%]".toUpperCase()), eq('\\'));
}
 
Example #6
Source File: RSQLUtilityTest.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void correctRsqlBuildsLikePredicateWithPercentage() {
    reset(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);
    final String correctRsql = "name==a%";
    when(baseSoftwareModuleRootMock.get("name")).thenReturn(baseSoftwareModuleRootMock);
    when(baseSoftwareModuleRootMock.getJavaType()).thenReturn((Class) SoftwareModule.class);
    when(criteriaBuilderMock.like(any(Expression.class), anyString(), eq('\\'))).thenReturn(mock(Predicate.class));
    when(criteriaBuilderMock.<String> greaterThanOrEqualTo(any(Expression.class), any(String.class)))
            .thenReturn(mock(Predicate.class));
    when(criteriaBuilderMock.upper(eq(pathOfString(baseSoftwareModuleRootMock))))
            .thenReturn(pathOfString(baseSoftwareModuleRootMock));
    // test
    RSQLUtility.parse(correctRsql, SoftwareModuleFields.class, null, Database.H2)
            .toPredicate(baseSoftwareModuleRootMock, criteriaQueryMock, criteriaBuilderMock);

    // verification
    verify(criteriaBuilderMock, times(1)).and(any(Predicate.class));
    verify(criteriaBuilderMock, times(1)).like(eq(pathOfString(baseSoftwareModuleRootMock)),
            eq("a\\%".toUpperCase()), eq('\\'));
}
 
Example #7
Source File: JpaSoftwareModuleManagement.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
public JpaSoftwareModuleManagement(final EntityManager entityManager,
        final DistributionSetRepository distributionSetRepository,
        final SoftwareModuleRepository softwareModuleRepository,
        final SoftwareModuleMetadataRepository softwareModuleMetadataRepository,
        final SoftwareModuleTypeRepository softwareModuleTypeRepository,
        final NoCountPagingRepository criteriaNoCountDao, final AuditorAware<String> auditorProvider,
        final ArtifactManagement artifactManagement, final QuotaManagement quotaManagement,
        final VirtualPropertyReplacer virtualPropertyReplacer, final Database database) {
    this.entityManager = entityManager;
    this.distributionSetRepository = distributionSetRepository;
    this.softwareModuleRepository = softwareModuleRepository;
    this.softwareModuleMetadataRepository = softwareModuleMetadataRepository;
    this.softwareModuleTypeRepository = softwareModuleTypeRepository;
    this.criteriaNoCountDao = criteriaNoCountDao;
    this.auditorProvider = auditorProvider;
    this.artifactManagement = artifactManagement;
    this.quotaManagement = quotaManagement;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.database = database;
}
 
Example #8
Source File: JpaRolloutManagement.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
JpaRolloutManagement(final TargetManagement targetManagement, final DeploymentManagement deploymentManagement,
        final RolloutGroupManagement rolloutGroupManagement,
        final DistributionSetManagement distributionSetManagement, final ApplicationContext context,
        final EventPublisherHolder eventPublisherHolder, final VirtualPropertyReplacer virtualPropertyReplacer,
        final PlatformTransactionManager txManager, final TenantAware tenantAware, final LockRegistry lockRegistry,
        final Database database, final RolloutApprovalStrategy rolloutApprovalStrategy,
        final TenantConfigurationManagement tenantConfigurationManagement,
        final SystemSecurityContext systemSecurityContext) {
    super(targetManagement, deploymentManagement, rolloutGroupManagement, distributionSetManagement, context,
            virtualPropertyReplacer, txManager, tenantAware, lockRegistry, rolloutApprovalStrategy,
            tenantConfigurationManagement, systemSecurityContext);
    this.eventPublisherHolder = eventPublisherHolder;
    this.database = database;
}
 
Example #9
Source File: RSQLUtility.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private JpqQueryRSQLVisitor(final Root<T> root, final CriteriaBuilder cb, final Class<A> enumType,
        final VirtualPropertyReplacer virtualPropertyReplacer, final Database database,
        final CriteriaQuery<?> query) {
    this.root = root;
    this.cb = cb;
    this.query = query;
    this.enumType = enumType;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.simpleTypeConverter = new SimpleTypeConverter();
    this.database = database;
    this.joinsNeeded = false;
}
 
Example #10
Source File: JpaDistributionSetTagManagement.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
JpaDistributionSetTagManagement(final DistributionSetTagRepository distributionSetTagRepository,
        final DistributionSetRepository distributionSetRepository,
        final VirtualPropertyReplacer virtualPropertyReplacer, final NoCountPagingRepository criteriaNoCountDao,
        final Database database) {
    this.distributionSetTagRepository = distributionSetTagRepository;
    this.distributionSetRepository = distributionSetRepository;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.criteriaNoCountDao = criteriaNoCountDao;
    this.database = database;
}
 
Example #11
Source File: JpaRolloutGroupManagement.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
JpaRolloutGroupManagement(final RolloutGroupRepository rolloutGroupRepository,
        final RolloutRepository rolloutRepository, final ActionRepository actionRepository,
        final TargetRepository targetRepository, final EntityManager entityManager,
        final VirtualPropertyReplacer virtualPropertyReplacer, final RolloutStatusCache rolloutStatusCache,
        final Database database) {

    this.rolloutGroupRepository = rolloutGroupRepository;
    this.rolloutRepository = rolloutRepository;
    this.actionRepository = actionRepository;
    this.targetRepository = targetRepository;
    this.entityManager = entityManager;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.rolloutStatusCache = rolloutStatusCache;
    this.database = database;
}
 
Example #12
Source File: JpaTargetFilterQueryManagement.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
JpaTargetFilterQueryManagement(final TargetFilterQueryRepository targetFilterQueryRepository,
        final TargetRepository targetRepository, final VirtualPropertyReplacer virtualPropertyReplacer,
        final DistributionSetManagement distributionSetManagement, final QuotaManagement quotaManagement,
        final Database database, final TenantConfigurationManagement tenantConfigurationManagement,
        final SystemSecurityContext systemSecurityContext) {
    this.targetFilterQueryRepository = targetFilterQueryRepository;
    this.targetRepository = targetRepository;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.distributionSetManagement = distributionSetManagement;
    this.quotaManagement = quotaManagement;
    this.database = database;
    this.tenantConfigurationManagement = tenantConfigurationManagement;
    this.systemSecurityContext = systemSecurityContext;
}
 
Example #13
Source File: JpaSoftwareModuleTypeManagement.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
public JpaSoftwareModuleTypeManagement(final DistributionSetTypeRepository distributionSetTypeRepository,
        final SoftwareModuleTypeRepository softwareModuleTypeRepository,
        final VirtualPropertyReplacer virtualPropertyReplacer,
        final SoftwareModuleRepository softwareModuleRepository, final NoCountPagingRepository criteriaNoCountDao,
        final Database database) {
    this.distributionSetTypeRepository = distributionSetTypeRepository;
    this.softwareModuleTypeRepository = softwareModuleTypeRepository;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.softwareModuleRepository = softwareModuleRepository;
    this.criteriaNoCountDao = criteriaNoCountDao;
    this.database = database;
}
 
Example #14
Source File: JpaDistributionSetTypeManagement.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
JpaDistributionSetTypeManagement(final DistributionSetTypeRepository distributionSetTypeRepository,
        final SoftwareModuleTypeRepository softwareModuleTypeRepository,
        final DistributionSetRepository distributionSetRepository,
        final VirtualPropertyReplacer virtualPropertyReplacer, final NoCountPagingRepository criteriaNoCountDao,
        final Database database, final QuotaManagement quotaManagement) {
    this.distributionSetTypeRepository = distributionSetTypeRepository;
    this.softwareModuleTypeRepository = softwareModuleTypeRepository;
    this.distributionSetRepository = distributionSetRepository;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.criteriaNoCountDao = criteriaNoCountDao;
    this.database = database;
    this.quotaManagement = quotaManagement;
}
 
Example #15
Source File: JpaDistributionSetManagement.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
JpaDistributionSetManagement(final EntityManager entityManager,
        final DistributionSetRepository distributionSetRepository,
        final DistributionSetTagManagement distributionSetTagManagement, final SystemManagement systemManagement,
        final DistributionSetTypeManagement distributionSetTypeManagement, final QuotaManagement quotaManagement,
        final DistributionSetMetadataRepository distributionSetMetadataRepository,
        final TargetFilterQueryRepository targetFilterQueryRepository, final ActionRepository actionRepository,
        final NoCountPagingRepository criteriaNoCountDao, final EventPublisherHolder eventPublisherHolder,
        final TenantAware tenantAware, final VirtualPropertyReplacer virtualPropertyReplacer,
        final SoftwareModuleRepository softwareModuleRepository,
        final DistributionSetTagRepository distributionSetTagRepository,
        final AfterTransactionCommitExecutor afterCommit, final Database database) {
    this.entityManager = entityManager;
    this.distributionSetRepository = distributionSetRepository;
    this.distributionSetTagManagement = distributionSetTagManagement;
    this.systemManagement = systemManagement;
    this.distributionSetTypeManagement = distributionSetTypeManagement;
    this.quotaManagement = quotaManagement;
    this.distributionSetMetadataRepository = distributionSetMetadataRepository;
    this.targetFilterQueryRepository = targetFilterQueryRepository;
    this.actionRepository = actionRepository;
    this.criteriaNoCountDao = criteriaNoCountDao;
    this.eventPublisherHolder = eventPublisherHolder;
    this.tenantAware = tenantAware;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.softwareModuleRepository = softwareModuleRepository;
    this.distributionSetTagRepository = distributionSetTagRepository;
    this.afterCommit = afterCommit;
    this.database = database;
}
 
Example #16
Source File: JpaDeploymentManagement.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
protected JpaDeploymentManagement(final EntityManager entityManager, final ActionRepository actionRepository,
        final DistributionSetRepository distributionSetRepository, final TargetRepository targetRepository,
        final ActionStatusRepository actionStatusRepository, final AuditorAware<String> auditorProvider,
        final EventPublisherHolder eventPublisherHolder, final AfterTransactionCommitExecutor afterCommit,
        final VirtualPropertyReplacer virtualPropertyReplacer, final PlatformTransactionManager txManager,
        final TenantConfigurationManagement tenantConfigurationManagement, final QuotaManagement quotaManagement,
        final SystemSecurityContext systemSecurityContext, final TenantAware tenantAware, final Database database,
        final RepositoryProperties repositoryProperties) {
    super(actionRepository, repositoryProperties);
    this.entityManager = entityManager;
    this.distributionSetRepository = distributionSetRepository;
    this.targetRepository = targetRepository;
    this.actionStatusRepository = actionStatusRepository;
    this.auditorProvider = auditorProvider;
    this.virtualPropertyReplacer = virtualPropertyReplacer;
    this.txManager = txManager;
    onlineDsAssignmentStrategy = new OnlineDsAssignmentStrategy(targetRepository, afterCommit, eventPublisherHolder,
            actionRepository, actionStatusRepository, quotaManagement, this::isMultiAssignmentsEnabled);
    offlineDsAssignmentStrategy = new OfflineDsAssignmentStrategy(targetRepository, afterCommit,
            eventPublisherHolder, actionRepository, actionStatusRepository, quotaManagement,
            this::isMultiAssignmentsEnabled);
    this.tenantConfigurationManagement = tenantConfigurationManagement;
    this.quotaManagement = quotaManagement;
    this.systemSecurityContext = systemSecurityContext;
    this.tenantAware = tenantAware;
    this.database = database;
    retryTemplate = createRetryTemplate();
}
 
Example #17
Source File: JpaConfiguration.java    From ps-guitar-db with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
	HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
	hibernateJpaVendorAdapter.setShowSql(true);
	hibernateJpaVendorAdapter.setGenerateDdl(true);
	hibernateJpaVendorAdapter.setDatabase(Database.H2);
	return hibernateJpaVendorAdapter;
}
 
Example #18
Source File: EmbeddedDataSourceConfig.java    From spring-sync with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
		HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
		hibernateJpaVendorAdapter.setShowSql(false);
		hibernateJpaVendorAdapter.setGenerateDdl(true);
		hibernateJpaVendorAdapter.setDatabase(Database.H2);
		return hibernateJpaVendorAdapter;
}
 
Example #19
Source File: DatabaseConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}
 
Example #20
Source File: DatabaseConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}
 
Example #21
Source File: DatabaseConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}
 
Example #22
Source File: DatabaseConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}
 
Example #23
Source File: DatabaseConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}
 
Example #24
Source File: DatabaseConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}
 
Example #25
Source File: DataStoreConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    final HibernateJpaVendorAdapter bean = new HibernateJpaVendorAdapter();
    bean.setDatabase(Database.H2);
    bean.setGenerateDdl(true);
    return bean;
}
 
Example #26
Source File: PersistenceConfig.java    From AIDR with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
	final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
	vendorAdapter.setDatabase(Database.MYSQL);
	vendorAdapter.setDatabasePlatform(dialect);
	vendorAdapter.setShowSql(false);
	vendorAdapter.setGenerateDdl(true);
	return vendorAdapter;
}
 
Example #27
Source File: Application.java    From JPA-Specifications-Example with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
	HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
	hibernateJpaVendorAdapter.setShowSql(false);
	hibernateJpaVendorAdapter.setGenerateDdl(true);
	hibernateJpaVendorAdapter.setDatabase(Database.H2);
	return hibernateJpaVendorAdapter;
}
 
Example #28
Source File: ElasticsearchConfig.java    From spring-content with Apache License 2.0 5 votes vote down vote up
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.H2);
    vendorAdapter.setGenerateDdl(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("org.springframework.content.elasticsearch");
    factory.setDataSource(dataSource());

    return factory;
}
 
Example #29
Source File: SpringDataJpaConfig.java    From Project with Apache License 2.0 5 votes vote down vote up
@Bean
public HibernateJpaVendorAdapter jpaVendorAdapter() {
  HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
  adapter.setDatabase(Database.H2);
  adapter.setShowSql(false);
  adapter.setGenerateDdl(true);
  return adapter;
}
 
Example #30
Source File: JpaConfig.java    From Project with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
  HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
  adapter.setDatabase(Database.H2);
  adapter.setShowSql(true);
  adapter.setGenerateDdl(false);
  adapter.setDatabasePlatform("org.hibernate.dialect.H2Dialect");
  return adapter;
}