Example usage for org.springframework.orm.jpa.vendor HibernateJpaDialect HibernateJpaDialect

List of usage examples for org.springframework.orm.jpa.vendor HibernateJpaDialect HibernateJpaDialect

Introduction

In this page you can find the example usage for org.springframework.orm.jpa.vendor HibernateJpaDialect HibernateJpaDialect.

Prototype

HibernateJpaDialect

Source Link

Usage

From source file:uk.co.parso.barebones.DbConfig.java

@Bean(name = "testEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean testEntityManagerFactory() throws SQLException {
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setPackagesToScan("uk.co.parso.barebones.entities");
    factory.setDataSource(testDataSource());
    factory.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    factory.setJpaProperties(hibProperties());
    factory.afterPropertiesSet();//from w w w  . j a v a2 s  . c om
    factory.setJpaDialect(new HibernateJpaDialect());

    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabase(Database.MYSQL);
    factory.setJpaVendorAdapter(adapter);

    return factory;
}

From source file:com.google.code.guice.repository.testing.runner.ManualBindRepoTestRunner.java

public ManualBindRepoTestRunner(Class<?> classToRun) throws InitializationError {
    super(classToRun, new JpaRepositoryModule() {
        @Override/*from   ww  w .ja v  a  2 s.  com*/
        protected void bindRepositories(RepositoryBinder binder) {
            binder.bind(UserRepository.class).to("test-h2");
            binder.bind(AccountRepository.class).withSelfDefinition();
            binder.bind(CustomerRepository.class).withCustomImplementation(CustomerRepositoryImpl.class)
                    .withSelfDefinition();
        }

        @Override
        protected Map<String, Object> getAdditionalEMFProperties(String persistenceUnitName) {
            Map<String, Object> properties = new HashMap<String, Object>();
            if ("test-h2".equals(persistenceUnitName)) {
                properties.put("jpaDialect", new HibernateJpaDialect());
                return properties;

            }
            return properties;
        }

        @Override
        protected Collection<String> getPersistenceUnitsNames() {
            return Arrays.asList("test-h2", "test-h2-secondary");
        }
    });
}

From source file:com.dominion.salud.pedicom.configuration.PEDICOMJpaConfiguration.java

@Bean
@Primary/*from   w ww .  j  av a  2 s .c om*/
@Autowired
public JpaTransactionManager transactionManager() throws Exception {
    JpaTransactionManager txManager = new JpaTransactionManager();
    JpaDialect jpaDialect = new HibernateJpaDialect();
    txManager.setEntityManagerFactory(entityManagerFactory());
    txManager.setJpaDialect(jpaDialect);
    txManager.setPersistenceUnitName("MainEM");
    return txManager;
}

From source file:com.dominion.salud.pedicom.configuration.PEDICOMJpaConfigurationCentral.java

@Bean(name = "CentralTr")
@Autowired//w  w w. ja  v  a  2s .c o m
public JpaTransactionManager transactionManager() throws Exception {
    JpaTransactionManager txManager = new JpaTransactionManager();
    JpaDialect jpaDialect = new HibernateJpaDialect();
    txManager.setEntityManagerFactory(entityManagerFactory());
    txManager.setPersistenceUnitName("CentralEM");
    txManager.setJpaDialect(jpaDialect);
    return txManager;
}

From source file:uk.co.parso.barebones.DbConfig.java

@Bean(name = "testTransactionManager")
public PlatformTransactionManager testTransactionManager() throws SQLException {

    JpaTransactionManager txManager = new JpaTransactionManager();
    txManager.setEntityManagerFactory(testEntityManagerFactory().getObject());
    txManager.setJpaDialect(new HibernateJpaDialect());
    return txManager;
}

From source file:com.dominion.salud.mpr.configuration.MPRJpaConfiguration.java

@Bean
@Autowired//w  ww  .j  a  va2 s  .  c om
public JpaTransactionManager transactionManager() {
    JpaTransactionManager txManager = new JpaTransactionManager();
    JpaDialect jpaDialect = new HibernateJpaDialect();
    txManager.setEntityManagerFactory(entityManagerFactory());
    txManager.setJpaDialect(jpaDialect);
    return txManager;
}

From source file:org.cambillaum.jpapersistor.persistence.configuration.PersistenceConfiguration.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactory.setDataSource(dataSource());
    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.show.sql", "true");
    jpaProperties.put("hibernate.hbm2ddl.auto", "create-drop");
    entityManagerFactory.setJpaProperties(jpaProperties);
    entityManagerFactory.setJpaVendorAdapter(jpaVendorAdapter());
    JpaDialect jpaDialect = new HibernateJpaDialect();
    entityManagerFactory.setJpaDialect(jpaDialect);
    entityManagerFactory.setPackagesToScan("org.cambillaum.jpapersistor");
    return entityManagerFactory;
}

From source file:org.duracloud.mill.credentials.impl.CredentialsRepoConfig.java

@Bean(name = TRANSACTION_MANAGER_BEAN)
public PlatformTransactionManager credentialsRepoTransactionManager(
        @Qualifier(ENTITY_MANAGER_FACTORY_BEAN) EntityManagerFactory entityManagerFactory) {
    JpaTransactionManager tm = new JpaTransactionManager(entityManagerFactory);
    tm.setJpaDialect(new HibernateJpaDialect());
    return tm;/*from  w  ww .  ja v a2 s.  com*/
}

From source file:com.google.code.guice.repository.testing.runner.AutoBindRepoTestRunner.java

public AutoBindRepoTestRunner(Class<?> classToRun) throws InitializationError {
    super(classToRun,
            new ScanningJpaRepositoryModule(
                    Arrays.asList(
                            RepositoriesGroupBuilder.forPackage("com.google.code.guice.repository.testing.repo")
                                    .withExclusionPattern(
                                            ".*" + UserDataRepository.class.getSimpleName() + ".*")
                                    .attachedTo("test-h2").build(),

                            RepositoriesGroupBuilder.forPackage("com.google.code.guice.repository.testing.repo")
                                    .withInclusionFilterPredicate(new Predicate<Class>() {
                                        @Override
                                        public boolean apply(@Nullable Class input) {
                                            return UserDataRepository.class.isAssignableFrom(input);
                                        }
                                    }).attachedTo("test-h2-secondary").build())) {
                @Override//  w ww.ja v a  2s.  c  om
                protected Map<String, Object> getAdditionalEMFProperties(String persistenceUnitName) {
                    Map<String, Object> properties = new HashMap<String, Object>();
                    if ("test-h2".equals(persistenceUnitName)) {
                        properties.put("jpaDialect", new HibernateJpaDialect());
                        return properties;

                    }
                    return properties;
                }

                @Override
                protected void bindRepositories(RepositoryBinder binder) {
                    super.bindRepositories(binder);
                    // manual bind specific repositories
                }
            }, new AbstractModule() {
                @Override
                protected void configure() {
                    bindInterceptor(Matchers.any(), Matchers.annotatedWith(Transactional.class),
                            new TestInterceptor());
                }
            });
}

From source file:com.springsource.html5expense.config.ComponentConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
    emfb.setJpaVendorAdapter(jpaAdapter());
    emfb.setDataSource(dataSource());/*from  ww  w .  j  a v a2 s  . c om*/
    emfb.setJpaPropertyMap(createPropertyMap());
    emfb.setJpaDialect(new HibernateJpaDialect());
    emfb.setPersistenceUnitName("sample");
    emfb.setPackagesToScan(new String[] { Expense.class.getPackage().getName() });
    return emfb;
}