void setSentryVersion(final String newVersion, final String verComment) throws Exception { tm.executeTransaction( pm -> { MSentryVersion mVersion; try { mVersion = getMSentryVersion(); if (newVersion.equals(mVersion.getSchemaVersion())) { // specified version already in there return null; } } catch (SentryNoSuchObjectException e) { // if the version doesn't exist, then create it mVersion = new MSentryVersion(); } mVersion.setSchemaVersion(newVersion); mVersion.setVersionComment(verComment); pm.makePersistent(mVersion); return null; }); }
public String getSentryVersion() throws SentryNoSuchObjectException, SentryAccessDeniedException { MSentryVersion mVersion = getMSentryVersion(); return mVersion.getSchemaVersion(); }
String getSentryVersion() throws Exception { MSentryVersion mVersion = getMSentryVersion(); return mVersion.getSchemaVersion(); }
public void setSentryVersion(String newVersion, String verComment) throws SentryNoSuchObjectException, SentryAccessDeniedException { MSentryVersion mVersion; boolean rollbackTransaction = true; PersistenceManager pm = null; try { mVersion = getMSentryVersion(); if (newVersion.equals(mVersion.getSchemaVersion())) { // specified version already in there return; } } catch (SentryNoSuchObjectException e) { // if the version doesn't exist, then create it mVersion = new MSentryVersion(); } mVersion.setSchemaVersion(newVersion); mVersion.setVersionComment(verComment); try { pm = openTransaction(); pm.makePersistent(mVersion); rollbackTransaction = false; commitTransaction(pm); } finally { if (rollbackTransaction) { rollbackTransaction(pm); } } }