Search in sources :

Example 1 with JDOObjectNotFoundException

use of javax.jdo.JDOObjectNotFoundException in project hive by apache.

the class ObjectStore method dropType.

@Override
public boolean dropType(String typeName) {
    boolean success = false;
    Query query = null;
    try {
        openTransaction();
        query = pm.newQuery(MType.class, "name == typeName");
        query.declareParameters("java.lang.String typeName");
        query.setUnique(true);
        MType type = (MType) query.execute(typeName.trim());
        pm.retrieve(type);
        if (type != null) {
            pm.deletePersistent(type);
        }
        success = commitTransaction();
    } catch (JDOObjectNotFoundException e) {
        success = commitTransaction();
        LOG.debug("type not found " + typeName, e);
    } finally {
        if (!success) {
            rollbackTransaction();
        }
        if (query != null) {
            query.closeAll();
        }
    }
    return success;
}
Also used : MType(org.apache.hadoop.hive.metastore.model.MType) Query(javax.jdo.Query) JDOObjectNotFoundException(javax.jdo.JDOObjectNotFoundException)

Aggregations

JDOObjectNotFoundException (javax.jdo.JDOObjectNotFoundException)1 Query (javax.jdo.Query)1 MType (org.apache.hadoop.hive.metastore.model.MType)1