Spring Framework HibernateJpaVendorAdapter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework HibernateJpaVendorAdapter class.

This code example shows how to use the following methods:setGenerateDdl, setShowSql
	@Bean 
	public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
		LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
		em.setJtaDataSource(dataSource());
		em.setPackagesToScan(new String[] { "com.test.wildflytransactions" });
		HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
		vendorAdapter.setShowSql(true);
		vendorAdapter.setGenerateDdl(true);
		em.setJpaVendorAdapter(vendorAdapter);
		em.setJpaProperties(additionalProperties());
		return em;
	} 
 
	@Bean 
	public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { 
		return new PersistenceExceptionTranslationPostProcessor(); 
	} 
 
	Properties additionalProperties() {
		Properties properties = new Properties();
6
CodeRank
This code example shows how to use the following methods:setGenerateDdl
public class DataConfig { 
 
	@Bean 
	public EntityManagerFactory entityManagerFactory() { 
 
		HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); 
		vendorAdapter.setGenerateDdl(true); 
 
		LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); 
		factory.setJpaVendorAdapter(vendorAdapter); 
		factory.setPackagesToScan("org.springframework.issues.domain"); 
		factory.setDataSource(h2Database()); 
		factory.setJpaPropertyMap(Collections.singletonMap("hibernate.show_sql", "true")); 
		factory.afterPropertiesSet(); 
 
		return factory.getObject(); 
	} 
 
	@Bean 
	public PlatformTransactionManager transactionManager() { 
6
CodeRank
This code example shows how to use the following methods:setDatabasePlatform, setGenerateDdl, setShowSql
 
    @Bean 
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() { 
        logger.debug("\n\n************ {} ************\n\n", 
                getDatabaseDialect().getCanonicalName()); 
        HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); 
        vendorAdapter.setGenerateDdl(true); 
        vendorAdapter.setDatabasePlatform(getDatabaseDialect().getName()); 
        vendorAdapter.setShowSql(true); 
 
        LocalContainerEntityManagerFactoryBean factory = 
                new LocalContainerEntityManagerFactoryBean(); 
        factory.setJpaVendorAdapter(vendorAdapter); 
        factory.setPackagesToScan(ItemEntity.class.getPackage().getName()); 
        factory.setDataSource(dataSource()); 
        if (getJpaProperties() != null) { 
            factory.setJpaProperties(getJpaProperties()); 
        } 
        return factory; 
    } 
6
CodeRank
This code example shows how to use the following methods:
 * Fix for missing type declarations for HSQL. 
 *  
 * @see http://www.codesmell.org/blog/2008/12/hibernate-hsql-native-queries-and-booleans/ 
 * @author Oliver Gierke 
 */ 
public class CustomHsqlHibernateJpaVendorAdaptor extends HibernateJpaVendorAdapter { 
 
	/*  
	 * (non-Javadoc) 
	 * @see org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#determineDatabaseDialectClass(org.springframework.orm.jpa.vendor.Database) 
	 */ 
	@Override 
	protected Class<?> determineDatabaseDialectClass(Database database) { 
 
		if (Database.HSQL.equals(database)) { 
			return CustomHsqlDialect.class; 
		} 
 
		return super.determineDatabaseDialectClass(database); 
	} 
5
CodeRank
This code example shows how to use the following methods:setGenerateDdl
        return new SimpleDriverDataSource(new Driver(), "jdbc:h2:mem:foo;DB_CLOSE_DELAY=-1", "sa", ""); 
    } 
 
    @Bean 
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() { 
        HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); 
        vendorAdapter.setGenerateDdl(true); 
        LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); 
        factoryBean.setJpaVendorAdapter(vendorAdapter); 
        factoryBean.setPersistenceProvider(new HibernatePersistence()); 
        factoryBean.setDataSource(dataSource()); 
        factoryBean.setPackagesToScan("rds.springdata"); 
        return factoryBean; 
    } 
 
    @Bean 
    public PlatformTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) { 
        return new JpaTransactionManager(entityManagerFactory); 
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
 
	private EntityManagerFactory getEntityManagerFactory(DataSource dataSource) throws Exception { 
		LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); 
		factory.setDataSource(dataSource); 
		factory.setPersistenceXmlLocation("classpath:org/springframework/webflow/persistence/persistence.xml"); 
		factory.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); 
		factory.afterPropertiesSet(); 
		return factory.getObject(); 
	} 
 
} 
5
CodeRank
This code example shows how to use the following methods:
	    
        lcemfb.setDataSource(this.hsqlInMemory()); 
        lcemfb.setPackagesToScan(new String[] {"com.jverstry"}); 
		lcemfb.setPersistenceUnitName("MyPU"); 
       
        HibernateJpaVendorAdapter va = new HibernateJpaVendorAdapter(); 
		lcemfb.setJpaVendorAdapter(va); 
		 
		Properties ps = new Properties(); 
		ps.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); 
		ps.put("hibernate.hbm2ddl.auto", "create"); 
		lcemfb.setJpaProperties(ps); 
		 
		lcemfb.afterPropertiesSet(); 
 
        return lcemfb; 
		 
    } 
    
    @Bean 
4
CodeRank
This code example shows how to use the following methods:
 
import java.util.Map; 
 
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; 
 
public class ExtendedHibernateJpaVendorAdapter extends HibernateJpaVendorAdapter { 
 
	private Map<String, Object> jpaPropertyMap; 
 
	@Override 
	public Map<String, Object> getJpaPropertyMap() { 
		return jpaPropertyMap; 
	} 
 
	public void setJpaPropertyMap(Map<String, Object> jpaPropertyMap) { 
		this.jpaPropertyMap = jpaPropertyMap; 
	} 
} 
5
CodeRank
This code example shows how to use the following methods:
    return emf; 
  } 
   
  @Bean 
  public JpaVendorAdapter jpaAdapter() { 
    HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter(); 
    return jpaVendorAdapter; 
  } 
 
  @Bean 
  public DataSource dataSource() { 
    final ComboPooledDataSource dataSource = new ComboPooledDataSource(); 
    // All options set from the externally loaded properties file! 
    return dataSource; 
  } 
 
  @Bean 
  public PlatformTransactionManager transactionManager() throws Exception { 
    JpaTransactionManager transactionManager = new JpaTransactionManager(); 
    transactionManager.setEntityManagerFactory(entityManagerFactory().getObject()); 
4
CodeRank
This code example shows how to use the following methods:setGenerateDdl
  } 
 
  @Bean 
  public EntityManagerFactory entityManagerFactory() throws SQLException { 
 
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); 
    vendorAdapter.setGenerateDdl(true); 
 
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); 
    factory.setJpaVendorAdapter(vendorAdapter); 
    factory.setPackagesToScan("com.yummynoodlebar.persistence.domain"); 
    factory.setDataSource(dataSource()); 
    factory.afterPropertiesSet(); 
 
    return factory.getObject(); 
  } 
 
  @Bean 
  public EntityManager entityManager(EntityManagerFactory entityManagerFactory) { 
    return entityManagerFactory.createEntityManager(); 
5
CodeRank
See Code Examples for Spring Framework HibernateJpaVendorAdapter Methods: