org.apache.ibatis.mapping.VendorDatabaseIdProvider Java Examples

The following examples show how to use org.apache.ibatis.mapping.VendorDatabaseIdProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HistoryDataSourceConfig.java    From c2mon with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Bean
public static SqlSessionFactoryBean historySqlSessionFactory(DataSource historyDataSource) throws Exception {
  SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
  sessionFactory.setDataSource(historyDataSource);
  sessionFactory.setTypeHandlersPackage("cern.c2mon.server.history.mapper");

  VendorDatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
  Properties properties = new Properties();
  properties.putAll(ImmutableMap.of(
      "HSQL", "oracle",
      "Oracle", "oracle",
      "MySQL", "mysql"
  ));
  databaseIdProvider.setProperties(properties);

  sessionFactory.setDatabaseIdProvider(databaseIdProvider);
  return sessionFactory;
}
 
Example #2
Source File: MybatisPlusConfigurer.java    From albedo with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Bean
public DatabaseIdProvider getDatabaseIdProvider() {
	DatabaseIdProvider databaseIdProvider = new VendorDatabaseIdProvider();
	Properties p = new Properties();
	p.setProperty("Oracle", "oracle");
	p.setProperty("MySQL", "mysql");
	databaseIdProvider.setProperties(p);
	return databaseIdProvider;
}
 
Example #3
Source File: Configuration.java    From Shop-for-JavaWeb with MIT License 5 votes vote down vote up
public Configuration() {
	typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
	typeAliasRegistry.registerAlias("MANAGED",
			ManagedTransactionFactory.class);

	typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
	typeAliasRegistry
			.registerAlias("POOLED", PooledDataSourceFactory.class);
	typeAliasRegistry.registerAlias("UNPOOLED",
			UnpooledDataSourceFactory.class);

	typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
	typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
	typeAliasRegistry.registerAlias("LRU", LruCache.class);
	typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
	typeAliasRegistry.registerAlias("WEAK", WeakCache.class);

	typeAliasRegistry.registerAlias("DB_VENDOR",
			VendorDatabaseIdProvider.class);

	typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
	typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);

	typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
	typeAliasRegistry.registerAlias("COMMONS_LOGGING",
			JakartaCommonsLoggingImpl.class);
	typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
	typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
	typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
	typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
	typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);

	typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
	typeAliasRegistry.registerAlias("JAVASSIST",
			JavassistProxyFactory.class);

	languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
	languageRegistry.register(RawLanguageDriver.class);
}
 
Example #4
Source File: ConfigDataSourceConfig.java    From c2mon with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Bean
public static SqlSessionFactoryBean configSqlSessionFactory(DataSource configurationDataSource,
                                                            VendorDatabaseIdProvider databaseIdProvider) throws Exception {
  SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
  sessionFactory.setDataSource(configurationDataSource);
  sessionFactory.setTypeHandlersPackage("cern.c2mon.server.configuration.mybatis");
  sessionFactory.setDatabaseIdProvider(databaseIdProvider);
  return sessionFactory;
}
 
Example #5
Source File: Configuration.java    From mybaties with Apache License 2.0 5 votes vote down vote up
public Configuration() {
  //注册更多的类型别名,至于为何不直接在TypeAliasRegistry里注册,还需进一步研究
  typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
  typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class);

  typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
  typeAliasRegistry.registerAlias("POOLED", PooledDataSourceFactory.class);
  typeAliasRegistry.registerAlias("UNPOOLED", UnpooledDataSourceFactory.class);

  typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
  typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
  typeAliasRegistry.registerAlias("LRU", LruCache.class);
  typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
  typeAliasRegistry.registerAlias("WEAK", WeakCache.class);

  typeAliasRegistry.registerAlias("DB_VENDOR", VendorDatabaseIdProvider.class);

  typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
  typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);

  typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
  typeAliasRegistry.registerAlias("COMMONS_LOGGING", JakartaCommonsLoggingImpl.class);
  typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
  typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
  typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
  typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
  typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);

  typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
  typeAliasRegistry.registerAlias("JAVASSIST", JavassistProxyFactory.class);

  languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
  languageRegistry.register(RawLanguageDriver.class);
}
 
Example #6
Source File: Configuration.java    From mybatis with Apache License 2.0 5 votes vote down vote up
public Configuration() {
  //注册更多的类型别名,至于为何不直接在TypeAliasRegistry里注册,还需进一步研究
  typeAliasRegistry.registerAlias("JDBC", JdbcTransactionFactory.class);
  typeAliasRegistry.registerAlias("MANAGED", ManagedTransactionFactory.class);

  typeAliasRegistry.registerAlias("JNDI", JndiDataSourceFactory.class);
  typeAliasRegistry.registerAlias("POOLED", PooledDataSourceFactory.class);
  typeAliasRegistry.registerAlias("UNPOOLED", UnpooledDataSourceFactory.class);

  typeAliasRegistry.registerAlias("PERPETUAL", PerpetualCache.class);
  typeAliasRegistry.registerAlias("FIFO", FifoCache.class);
  typeAliasRegistry.registerAlias("LRU", LruCache.class);
  typeAliasRegistry.registerAlias("SOFT", SoftCache.class);
  typeAliasRegistry.registerAlias("WEAK", WeakCache.class);

  typeAliasRegistry.registerAlias("DB_VENDOR", VendorDatabaseIdProvider.class);

  typeAliasRegistry.registerAlias("XML", XMLLanguageDriver.class);
  typeAliasRegistry.registerAlias("RAW", RawLanguageDriver.class);

  typeAliasRegistry.registerAlias("SLF4J", Slf4jImpl.class);
  typeAliasRegistry.registerAlias("COMMONS_LOGGING", JakartaCommonsLoggingImpl.class);
  typeAliasRegistry.registerAlias("LOG4J", Log4jImpl.class);
  typeAliasRegistry.registerAlias("LOG4J2", Log4j2Impl.class);
  typeAliasRegistry.registerAlias("JDK_LOGGING", Jdk14LoggingImpl.class);
  typeAliasRegistry.registerAlias("STDOUT_LOGGING", StdOutImpl.class);
  typeAliasRegistry.registerAlias("NO_LOGGING", NoLoggingImpl.class);

  typeAliasRegistry.registerAlias("CGLIB", CglibProxyFactory.class);
  typeAliasRegistry.registerAlias("JAVASSIST", JavassistProxyFactory.class);

  languageRegistry.setDefaultDriverClass(XMLLanguageDriver.class);
  languageRegistry.register(RawLanguageDriver.class);
}