當前位置: 首頁>>代碼示例>>Java>>正文


Java HibernateException.getMessage方法代碼示例

本文整理匯總了Java中org.hibernate.HibernateException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java HibernateException.getMessage方法的具體用法?Java HibernateException.getMessage怎麽用?Java HibernateException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.HibernateException的用法示例。


在下文中一共展示了HibernateException.getMessage方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getKeys

import org.hibernate.HibernateException; //導入方法依賴的package包/類
public Collection<String> getKeys(Long piid, String prefix, Type type) {

        if( piid == null)
            throw new PersistentVarsException("Could not find keys for 'null' piid");

        Session session = null;
        Transaction transaction = null;
        Collection<String> list = null;
        
        try {
            session = sessionFactory.openSession();
            transaction = session.beginTransaction();

            list = getKeysImpl(session, piid, prefix, type);

            transaction.commit();

        } catch (HibernateException hibernateException) {
            throw new PersistentVarsException("HibernatePropertySet.getKeys: " + hibernateException.getMessage());
        } finally {
            if (transaction != null && transaction.isActive())
                 transaction.rollback();

            if (session != null)
                session.close();
        } 

        return list;
    }
 
開發者ID:will-gilbert,項目名稱:OSWf-OSWorkflow-fork,代碼行數:30,代碼來源:HibernatePersistentVarsDAO.java

示例2: save

import org.hibernate.HibernateException; //導入方法依賴的package包/類
public void save(HibernatePersistentVarsItem item) {

        if( item == null)
            throw new PersistentVarsException("Could not save 'null' PropertyItem");
 
       Session session = null;
       Transaction transaction = null;

        try {
            session = this.sessionFactory.openSession();
            transaction = session.beginTransaction();
            
            session.saveOrUpdate(item);
            session.flush();
            
            transaction.commit();
            
        } catch (HibernateException hibernateException) {
            throw new PersistentVarsException("Could not save key '" + item.getKey() + "':" + hibernateException.getMessage());
        } finally {
            
            if (transaction != null && transaction.isActive())
                 transaction.rollback();

            if (session != null)
                session.close();
        }
    }
 
開發者ID:will-gilbert,項目名稱:OSWf-OSWorkflow-fork,代碼行數:29,代碼來源:HibernatePersistentVarsDAO.java

示例3: findByKey

import org.hibernate.HibernateException; //導入方法依賴的package包/類
public HibernatePersistentVarsItem findByKey(Long piid, String key) {

        if( piid == null)
            throw new PersistentVarsException("Could not find property for 'null' piid");

        if( key == null)
            throw new PersistentVarsException("Could not find property for 'null' key");
        
        Session session = null;
        Transaction transaction = null;
        HibernatePersistentVarsItem item = null;

        try {

            session = sessionFactory.openSession();
            transaction = session.beginTransaction();

            item = getItem(session, piid, key);
            session.flush();

            transaction.commit();

        } catch (HibernateException hibernateException) {
            throw new PersistentVarsException("Could not find key '" + key + "': " + hibernateException.getMessage());
        } finally {
            if (transaction != null && transaction.isActive())
                 transaction.rollback();

            if (session != null)
                session.close();
        }

        return item;
    }
 
開發者ID:will-gilbert,項目名稱:OSWf-OSWorkflow-fork,代碼行數:35,代碼來源:HibernatePersistentVarsDAO.java

示例4: remove

import org.hibernate.HibernateException; //導入方法依賴的package包/類
public void remove(Long piid, String key) {


        if( piid == null)
            throw new PersistentVarsException("Could not remove property for 'null' piid");

        if( key == null)
            throw new PersistentVarsException("Could not remove property with 'null' key");

       Session session = null;
       Transaction transaction = null;

        try {
            session = this.sessionFactory.openSession();
            transaction = session.beginTransaction();

            session.delete(getItem(session, piid, key));
            session.flush();

            transaction.commit();
        } catch (HibernateException hibernateException) {
            throw new PersistentVarsException("Could not remove key '" + key + "': " + hibernateException.getMessage());
        } finally {
            
            if (transaction != null && transaction.isActive())
                 transaction.rollback();
            
            if (session != null) 
                session.close();
        }
    }
 
開發者ID:will-gilbert,項目名稱:OSWf-OSWorkflow-fork,代碼行數:32,代碼來源:HibernatePersistentVarsDAO.java

示例5: create

import org.hibernate.HibernateException; //導入方法依賴的package包/類
public HibernatePersistentVarsItem create(Long piid, String key) {

       if( piid == null)
           throw new PersistentVarsException("Could not create property with 'null' piid");

       if( key == null)
           throw new PersistentVarsException("Could not create property with 'null' key");
           
      Session session = null;
      Transaction transaction = null;
   
       HibernatePersistentVarsItem item = new HibernatePersistentVarsItem(piid, key);

       try {
           session = this.sessionFactory.openSession();
           transaction = session.beginTransaction();

           session.save(item);

           transaction.commit();

       } catch (HibernateException hibernateException) {
           throw new PersistentVarsException("Could not save key '" + key + "': " + hibernateException.getMessage());
       } finally {
           
           if (transaction != null && transaction.isActive())
                transaction.rollback();
           
           if (session != null) 
               session.close();
       }
       
       return item;
   }
 
開發者ID:will-gilbert,項目名稱:OSWf-OSWorkflow-fork,代碼行數:35,代碼來源:HibernatePersistentVarsDAO.java

示例6: HibernateSystemException

import org.hibernate.HibernateException; //導入方法依賴的package包/類
/**
 * Create a new HibernateSystemException,
 * wrapping an arbitrary HibernateException.
 * @param cause the HibernateException thrown
 */
public HibernateSystemException(HibernateException cause) {
	super(cause != null ? cause.getMessage() : null, cause);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:9,代碼來源:HibernateSystemException.java


注:本文中的org.hibernate.HibernateException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。