Java 类org.hibernate.dialect.PostgreSQL9Dialect 实例源码

项目:jpa2ddl    文件:DatabaseSchemaUpdateTest.java   
@Test
public void shouldGenerateSchemaFromDatabaseWithUpdateWithPostgresDialect() throws Exception {
    // given
    File outputPath = tempFolder.newFolder();
    Properties jpaProperties = new Properties();
    jpaProperties.setProperty("hibernate.dialect", PostgreSQL9Dialect.class.getCanonicalName());

    SchemaGenerator schemaGenerator = new SchemaGenerator();

    // when
    schemaGenerator.generate(new GeneratorSettings(GenerationMode.DATABASE, outputPath,
            Arrays.asList("com.devskiller.jpa2ddl.sample"), Action.UPDATE, jpaProperties, true, ";", false));

    // then
    String sql = new String(Files.readAllBytes(outputPath.toPath().resolve("v1__jpa2ddl.sql")));
    assertThat(sql).contains("create table User");
    assertThat(sql).doesNotContain("drop table User");
}
项目:invesdwin-context-persistence    文件:HibernateDialectSpecificDelegate.java   
private Class<? extends Dialect> getHibernateDialect(final PersistenceUnitContext context) {
    final ConnectionDialect dialect = context.getConnectionDialect();
    switch (dialect) {
    case MSSQLSERVER:
        return SQLServerDialect.class;
    case MYSQL:
        return MySQL5InnoDBDialect.class;
    case POSTGRESQL:
        return PostgreSQL9Dialect.class;
    case ORACLE:
        return Oracle10gDialect.class;
    case H2:
        return H2Dialect.class;
    default:
        throw UnknownArgumentException.newInstance(ConnectionDialect.class, dialect);
    }
}
项目:2fa-demo    文件:PersistenceJpaConfig.java   
private Properties additionalProperties() {
    String dialect;

    switch (dbType) {
    case "postgres":
        dialect = PostgreSQL9Dialect.class.getName();
        break;
    case "mysql":
        dialect = MySQL5InnoDBDialect.class.getName();
        break;
    default:
        throw new IllegalArgumentException(dbType + " not recognized");
    }

    log.debug("Setting hibernate dialect {}", dialect);

    Properties properties = new Properties();
    properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
    properties.setProperty("hibernate.dialect", dialect);
    properties.setProperty("hibernate.show_sql", "false");
    return properties;
}
项目:mycore    文件:MCRHibernateConfigHelper.java   
public static void checkEntityManagerFactoryConfiguration(EntityManagerFactory entityManagerFactory) {
    try {
        SessionFactoryImpl sessionFactoryImpl = entityManagerFactory.unwrap(SessionFactoryImpl.class);
        if (PostgreSQL9Dialect.class
            .isInstance(sessionFactoryImpl.getServiceRegistry().getService(JdbcServices.class).getDialect())) {
            //fix ClassLeftUnique and ClassRightUnique, as PostgreSQL cannot evaluate them on statement level
            modifyConstraints(sessionFactoryImpl);
        }
    } catch (PersistenceException e) {
        LogManager.getLogger()
            .warn("Unsupported EntityManagerFactory found: {}", entityManagerFactory.getClass().getName());
    }
}
项目:wonderjameeee    文件:DatabaseConfiguration.java   
@Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
        HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        vendorAdapter.setDatabase(Database.POSTGRESQL);
        vendorAdapter.setGenerateDdl(true);

        LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
        factory.setJpaVendorAdapter(vendorAdapter);
        factory.setPackagesToScan("hu.cherubits.wonderjam.entities");
        factory.setDataSource(dataSource());
        factory.getJpaPropertyMap().put("hibernate.dialect", PostgreSQL9Dialect.class.getCanonicalName());
//        factory.getJpaPropertyMap().put("spring.jpa.hibernate.ddl-auto", "create");

        return factory;
    }
项目:tenancy-sample    文件:TenancySampleApplication.java   
public
@Bean
EntityManagerFactory customEntityManagerFactory(DataSource dataSource) {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(false); // turn off with Discriminator strategy so far!
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(TenancySampleApplication.class.getPackage().getName());
    factory.setDataSource(dataSource);
    factory.getJpaPropertyMap().put(Environment.DIALECT, PostgreSQL9Dialect.class.getName());
    factory.getJpaPropertyMap().put(Environment.MULTI_TENANT, MultiTenancyStrategy.DISCRIMINATOR);
    factory.getJpaPropertyMap().put(Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, new TenantHolder());
    factory.afterPropertiesSet();
    return factory.getObject();
}
项目:hibernate-conventions    文件:DDLConventionsForPostgreSQL9DialectIT.java   
@Before
public void setUp() throws Exception {
    entityManagerFactory = Persistence.createEntityManagerFactory("sequence");
    conventions = DDLConventions.create(entityManagerFactory, new PostgreSQL9Dialect() {

        @Override
        public String getQuerySequencesString() {
            return null;
        }

    });
}
项目:lams    文件:StrategySelectorBuilder.java   
private void addDialects(StrategySelectorImpl strategySelector) {
    addDialect( strategySelector, Cache71Dialect.class );
    addDialect( strategySelector, CUBRIDDialect.class );
    addDialect( strategySelector, DB2Dialect.class );
    addDialect( strategySelector, DB2390Dialect.class );
    addDialect( strategySelector, DB2400Dialect.class );
    addDialect( strategySelector, DerbyTenFiveDialect.class );
    addDialect( strategySelector, DerbyTenSixDialect.class );
    addDialect( strategySelector, DerbyTenSevenDialect.class );
    addDialect( strategySelector, FirebirdDialect.class );
    addDialect( strategySelector, FrontBaseDialect.class );
    addDialect( strategySelector, H2Dialect.class );
    addDialect( strategySelector, HSQLDialect.class );
    addDialect( strategySelector, InformixDialect.class );
    addDialect( strategySelector, IngresDialect.class );
    addDialect( strategySelector, Ingres9Dialect.class );
    addDialect( strategySelector, Ingres10Dialect.class );
    addDialect( strategySelector, InterbaseDialect.class );
    addDialect( strategySelector, JDataStoreDialect.class );
    addDialect( strategySelector, MckoiDialect.class );
    addDialect( strategySelector, MimerSQLDialect.class );
    addDialect( strategySelector, MySQL5Dialect.class );
    addDialect( strategySelector, MySQL5InnoDBDialect.class );
    addDialect( strategySelector, MySQL5Dialect.class );
    addDialect( strategySelector, MySQL5InnoDBDialect.class );
    addDialect( strategySelector, Oracle8iDialect.class );
    addDialect( strategySelector, Oracle9iDialect.class );
    addDialect( strategySelector, Oracle10gDialect.class );
    addDialect( strategySelector, PointbaseDialect.class );
    addDialect( strategySelector, PostgresPlusDialect.class );
    addDialect( strategySelector, PostgreSQL81Dialect.class );
    addDialect( strategySelector, PostgreSQL82Dialect.class );
    addDialect( strategySelector, PostgreSQL9Dialect.class );
    addDialect( strategySelector, ProgressDialect.class );
    addDialect( strategySelector, SAPDBDialect.class );
    addDialect( strategySelector, SQLServerDialect.class );
    addDialect( strategySelector, SQLServer2005Dialect.class );
    addDialect( strategySelector, SQLServer2008Dialect.class );
    addDialect( strategySelector, Sybase11Dialect.class );
    addDialect( strategySelector, SybaseAnywhereDialect.class );
    addDialect( strategySelector, SybaseASE15Dialect.class );
    addDialect( strategySelector, SybaseASE157Dialect.class );
    addDialect( strategySelector, TeradataDialect.class );
    addDialect( strategySelector, TimesTenDialect.class );
}
项目:hibernate-types    文件:PostgreSQLDataSourceProvider.java   
@Override
public String hibernateDialect() {
    return PostgreSQL9Dialect.class.getName();
}