当前位置: 首页>>代码示例>>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;未经允许,请勿转载。