Example usage for javax.persistence ValidationMode CALLBACK

List of usage examples for javax.persistence ValidationMode CALLBACK

Introduction

In this page you can find the example usage for javax.persistence ValidationMode CALLBACK.

Prototype

ValidationMode CALLBACK

To view the source code for javax.persistence ValidationMode CALLBACK.

Click Source Link

Document

The persistence provider must perform the lifecycle event validation.

Usage

From source file:com.devicehive.application.RdbmsPersistenceConfig.java

@Bean
@Autowired// w  w w  . java2s  .c o  m
@DependsOn(value = { "simpleApplicationContextHolder" })
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
    factoryBean.setDataSource(dataSource);
    factoryBean.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    factoryBean.setValidationMode(ValidationMode.CALLBACK);
    factoryBean.setJpaVendorAdapter(jpaVendorAdapter);
    factoryBean.setPackagesToScan("com.devicehive.model");

    final Properties props = new Properties();
    props.putAll(this.properties.getHibernateProperties(this.dataSource));
    factoryBean.setJpaProperties(props);
    return factoryBean;
}