如何使用activejdbc刷新物化视图?

时间:2017-06-15 17:59:13

标签: activejdbc

我尝试过使用Base.exec / new DB("default").exec("refresh materialized view concurrently ...,但都没有效果。没有错误,但声明没有运行。

1 个答案:

答案 0 :(得分:0)

终于弄明白了。不确定原因,但Base.exec不起作用,只有Statement.executeUpdate

// Open your connection
String sql = "refresh materialized view concurrently MY_VIEW";
try {
    Connection conn = new DB("default").connection();
    Statement stmt = conn.createStatement();
    stmt.executeUpdate(sql);
    conn.commit();
    stmt.close();
} catch (SQLException e) {
    e.printStackTrace();
}