private String getSynonymOwner(String synonymName) { PreparedStatement ps = null; ResultSet rs = null; String ret = null; try { ps = getConnection() .prepareStatement( "select table_owner from sys.all_synonyms where table_name=? and owner=?"); ps.setString(1, synonymName); ps.setString(2, getSchema()); rs = ps.executeQuery(); if (rs.next()) { ret = rs.getString(1); } else { String databaseStructure = getDatabaseStructureInfo(); throw new RuntimeException( "Wow! Synonym " + synonymName + " not found. How can it happen? " + databaseStructure); } } catch (SQLException e) { String databaseStructure = getDatabaseStructureInfo(); GLogger.error(e.getMessage(), e); throw new RuntimeException("Exception in getting synonym owner " + databaseStructure); } finally { dbHelper.close(rs, ps); } return ret; }
/** 得到模板可以引用的工具类 */ private static Map getToolsMap() { Map toolsMap = new HashMap(); String[] tools = GeneratorProperties.getStringArray(GENERATOR_TOOLS_CLASS); for (String className : tools) { try { Object instance = ClassHelper.newInstance(className); toolsMap.put(Class.forName(className).getSimpleName(), instance); GLogger.debug( "put tools class:" + className + " with key:" + Class.forName(className).getSimpleName()); } catch (Exception e) { GLogger.error("cannot load tools by className:" + className + " cause:" + e); } } return toolsMap; }