本文整理了Java中org.hibernate.cfg.Configuration.registerTypeOverride()
方法的一些代码示例,展示了Configuration.registerTypeOverride()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.registerTypeOverride()
方法的具体详情如下:
包路径:org.hibernate.cfg.Configuration
类名称:Configuration
方法名:registerTypeOverride
[英]Allows registration of a type into the type registry. The phrase 'override' in the method name simply reminds that registration potentially replaces a previously registered type .
[中]允许将类型注册到类型注册表中。方法名称中的短语“override”只是提醒注册可能替换以前注册的类型。
代码示例来源:origin: hibernate/hibernate-orm
@Override
public void configure(Configuration cfg) {
cfg.registerTypeOverride(
new UUIDCharType() {
@Override
protected boolean registerUnderJavaType() {
return true;
}
}
);
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public void configure(Configuration cfg) {
cfg.registerTypeOverride( StoredPrefixedStringType.INSTANCE );
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
public void configure(Configuration cfg) {
if ( Oracle8iDialect.class.isInstance( getDialect() ) ) {
cfg.registerTypeOverride( TextAsMaterializedClobType.INSTANCE );
}
cfg.setProperty( Environment.GENERATE_STATISTICS, "true");
cfg.setProperty( Environment.STATEMENT_BATCH_SIZE, "0" );
}
代码示例来源:origin: hibernate/hibernate-orm
public void configure(Configuration cfg) {
if ( Oracle8iDialect.class.isInstance( getDialect() ) ) {
cfg.registerTypeOverride( TextAsMaterializedClobType.INSTANCE );
}
cfg.setProperty(Environment.USE_SECOND_LEVEL_CACHE, "false");
cfg.setProperty(Environment.GENERATE_STATISTICS, "true");
cfg.setProperty(Environment.DEFAULT_BATCH_FETCH_SIZE, "2");
}
代码示例来源:origin: org.n52.sensorweb.sos/hibernate-session-factory
private void registerTimestampMapping(Configuration configuration, Properties properties) {
if (properties.containsKey(HIBERNATE_DATASOURCE_TIMEZONE)
&& !properties.getProperty(HIBERNATE_DATASOURCE_TIMEZONE).isEmpty()) {
configuration.registerTypeOverride(
new ConfigurableTimestampType(properties.getProperty(HIBERNATE_DATASOURCE_TIMEZONE)));
} else {
configuration.registerTypeOverride(new UtcTimestampType());
}
configuration.registerTypeOverride(new IsoTimeStringType(properties.getProperty(HIBERNATE_DATASOURCE_TIMEZONE),
properties.getProperty(HIBERNATE_DATASOURCE_TIME_STRING_FORMAT),
Boolean.valueOf(properties.getProperty(HIBERNATE_DATASOURCE_TIME_STRING_Z))));
}
代码示例来源:origin: 52North/SOS
private void registerTimestampMapping(Configuration configuration, Properties properties) {
if (properties.containsKey(HIBERNATE_DATASOURCE_TIMEZONE)
&& !properties.getProperty(HIBERNATE_DATASOURCE_TIMEZONE).isEmpty()) {
configuration.registerTypeOverride(
new ConfigurableTimestampType(properties.getProperty(HIBERNATE_DATASOURCE_TIMEZONE)));
} else {
configuration.registerTypeOverride(new UtcTimestampType());
}
configuration.registerTypeOverride(new IsoTimeStringType(properties.getProperty(HIBERNATE_DATASOURCE_TIMEZONE),
properties.getProperty(HIBERNATE_DATASOURCE_TIME_STRING_FORMAT),
Boolean.valueOf(properties.getProperty(HIBERNATE_DATASOURCE_TIME_STRING_Z))));
}
代码示例来源:origin: flipkart-incubator/flux
private void addAnnotatedClassesAndTypes(Configuration configuration) {
//register hibernate custom types
configuration.registerTypeOverride(new BlobType(), new String[]{"BlobType"});
configuration.registerTypeOverride(new StoreFQNType(), new String[]{"StoreFQNOnly"});
configuration.registerTypeOverride(new ListJsonType(), new String[]{"ListJsonType"});
configuration.addAnnotatedClass(ScheduledMessage.class);
configuration.addAnnotatedClass(ScheduledEvent.class);
configuration.addAnnotatedClass(ClientElb.class);
}
代码示例来源:origin: 52North/SOS
private SessionFactory createSessionFactory(Properties properties) {
Configuration cfg = new Configuration();
for (Class<?> clazz : getAnnotatedClasses()) {
cfg.addAnnotatedClass(clazz);
}
cfg.registerTypeOverride(new HibernateFileType(),
new String[] { "file", File.class.getName() });
cfg.registerTypeOverride(new HibernateUriType(),
new String[] { "uri", URI.class.getName() });
cfg.registerTypeOverride(new HibernateTimeInstantType(),
new String[] { "timeInstant", TimeInstant.class.getName() });
if (properties != null) {
cfg.mergeProperties(properties);
}
cfg.mergeProperties(getDefaultProperties());
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
.applySettings(cfg.getProperties()).build();
return cfg.buildSessionFactory(serviceRegistry);
}
代码示例来源:origin: bonitasoft/bonita-engine
if (dialect.toLowerCase().contains("postgresql")) {
configuration.setInterceptor(new PostgresInterceptor());
configuration.registerTypeOverride(new PostgresMaterializedBlobType());
configuration.registerTypeOverride(new PostgresMaterializedClobType());
configuration.registerTypeOverride(new PostgresXMLType());
queryBuilderFactory.setVendor(POSTGRES);
} else if (dialect.toLowerCase().contains("sqlserver")) {
SQLServerInterceptor sqlServerInterceptor = new SQLServerInterceptor();
configuration.setInterceptor(sqlServerInterceptor);
configuration.registerTypeOverride(new XMLType());
orderByBuilder = new SQLServerOrderByBuilder();
queryBuilderFactory.setVendor(SQLSERVER);
} else if (dialect.toLowerCase().contains("oracle")) {
configuration.registerTypeOverride(new XMLType());
queryBuilderFactory.setVendor(ORACLE);
} else if (dialect.toLowerCase().contains("mysql")) {
configuration.registerTypeOverride(new XMLType());
queryBuilderFactory.setVendor(MYSQL);
}else{
configuration.registerTypeOverride(new XMLType());
代码示例来源:origin: bonitasoft/bonita-engine
if (dialect.toLowerCase().contains("postgresql")) {
configuration.setInterceptor(new PostgresInterceptor());
configuration.registerTypeOverride(new PostgresMaterializedBlobType());
configuration.registerTypeOverride(new PostgresMaterializedClobType());
configuration.registerTypeOverride(new PostgresXMLType());
queryBuilderFactory.setVendor(POSTGRES);
} else if (dialect.toLowerCase().contains("sqlserver")) {
SQLServerInterceptor sqlServerInterceptor = new SQLServerInterceptor();
configuration.setInterceptor(sqlServerInterceptor);
configuration.registerTypeOverride(new XMLType());
orderByBuilder = new SQLServerOrderByBuilder();
queryBuilderFactory.setVendor(SQLSERVER);
} else if (dialect.toLowerCase().contains("oracle")) {
configuration.registerTypeOverride(new XMLType());
queryBuilderFactory.setVendor(ORACLE);
} else if (dialect.toLowerCase().contains("mysql")) {
configuration.registerTypeOverride(new XMLType());
queryBuilderFactory.setVendor(MYSQL);
}else{
configuration.registerTypeOverride(new XMLType());
内容来源于网络,如有侵权,请联系作者删除!