Package org.apache.ibatis.mapping

Examples of org.apache.ibatis.mapping.DatabaseIdProvider


        throw new BuilderException("Database element may provide a database id or a provider, but not both.");   
      }
      if (id != null) {
        builder.databaseId(id);
      } else if (type != null) {
        DatabaseIdProvider databaseIdProvider = (DatabaseIdProvider) resolveClass(type).newInstance();
        Properties props = context.getChildrenAsProperties();
        databaseIdProvider.setProperties(props);
        builder.databaseIdProvider(databaseIdProvider);
      }
    }
  }
View Full Code Here


      }
    }
  }

  private void databaseIdProviderElement(XNode context) throws Exception {
    DatabaseIdProvider databaseIdProvider = null;
    if (context != null) {
      String type = context.getStringAttribute("type");
      // awful patch to keep backward compatibility
      if ("VENDOR".equals(type)) {
          type = "DB_VENDOR";
      }
      Properties properties = context.getChildrenAsProperties();
      databaseIdProvider = (DatabaseIdProvider) resolveClass(type).newInstance();
      databaseIdProvider.setProperties(properties);
    }
    Environment environment = configuration.getEnvironment();
    if (environment != null && databaseIdProvider != null) {
      String databaseId = databaseIdProvider.getDatabaseId(environment.getDataSource());
      configuration.setDatabaseId(databaseId);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.ibatis.mapping.DatabaseIdProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.