
org.hibernate.examples.jpa.config.AbstractH2JpaConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-examples Show documentation
Show all versions of hibernate-examples Show documentation
Hibernate 2nd level cache using Redis examples.
The newest version!
package org.hibernate.examples.jpa.config;
import org.hibernate.cfg.Environment;
import org.springframework.context.annotation.Bean;
import javax.sql.DataSource;
import java.util.Properties;
/**
* AbstractH2JpaConfiguration
*
* @author [email protected]
* @since 2014. 2. 28.
*/
public abstract class AbstractH2JpaConfiguration extends AbstractJpaConfiguration {
public static final String DRIVER_CLASS_H2 = "org.h2.Driver";
public static final String DIALECT_H2 = "org.hibernate.dialect.H2Dialect";
@Bean
@Override
public DataSource dataSource() {
return buildDataSource(DRIVER_CLASS_H2,
"jdbc:h2:mem:" + getDatabaseName() + ";DB_CLOSE_DELAY=-1;MVCC=TRUE;",
"sa",
"");
}
@Override
public Properties jpaProperties() {
Properties props = super.jpaProperties();
props.put(Environment.DIALECT, DIALECT_H2);
return props;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy