Java Code Examples for org.hibernate.HibernateException#getMessage()
The following examples show how to use
org.hibernate.HibernateException#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DatabaseMetadataDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Execute query */ public static DatabaseMetadataValue executeValueQueryUnique(String query) throws DatabaseException { log.debug("executeValueQueryUnique({})", query); Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); Query q = session.createQuery(query); DatabaseMetadataValue ret = (DatabaseMetadataValue) q.uniqueResult(); HibernateUtil.commit(tx); log.debug("executeValueQueryUnique: {}", ret); return ret; } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 2
Source File: ProposedSubscriptionDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Delete received proposed subscription */ public static void deleteReceived(int psId) throws DatabaseException { log.debug("deleteReceived({})", psId); Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); ProposedSubscriptionReceived ps = (ProposedSubscriptionReceived) session.load(ProposedSubscriptionReceived.class, psId); session.delete(ps); HibernateUtil.commit(tx); } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } log.debug("delete: void"); }
Example 3
Source File: DashboardDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Find by user source */ @SuppressWarnings("unchecked") public static List<Dashboard> findByUserSource(String user, String source) throws DatabaseException { log.debug("findByUserSource({}, {})", user, source); String qs = "from Dashboard db where db.user=:user and db.source=:source"; Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); Query q = session.createQuery(qs); q.setString("user", user); q.setString("source", source); List<Dashboard> ret = q.list(); log.debug("findByUserSource: " + ret); return ret; } catch (HibernateException e) { throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 4
Source File: AutomationDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * find filtered riles */ @SuppressWarnings("unchecked") public List<AutomationRule> findByEvent(String event, String at) throws DatabaseException { log.debug("findByEvent({}, {})", event, at); String qs = "from AutomationRule ar where ar.event=:event and ar.at=:at order by ar.order"; Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); Query q = session.createQuery(qs); q.setString("event", event); q.setString("at", at); List<AutomationRule> ret = q.list(); initializeRules(ret); log.debug("findByEvent: {}", ret); return ret; } catch (HibernateException e) { throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 5
Source File: ReportDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Create */ public static long create(Report rp) throws DatabaseException { log.debug("create({})", rp); Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); Long id = (Long) session.save(rp); HibernateUtil.commit(tx); log.debug("create: {}", id); return id; } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 6
Source File: AutomationDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Delete action */ public void deleteAction(long aaId) throws DatabaseException { log.debug("deleteAction({})", aaId); Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); AutomationAction aa = (AutomationAction) session.load(AutomationAction.class, aaId); session.delete(aa); HibernateUtil.commit(tx); } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } log.debug("deleteAction: void"); }
Example 7
Source File: ForumDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Find by pk */ public static ForumTopic findTopicByPk(long id) throws DatabaseException { log.debug("findTopicByPk({})"); Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); ForumTopic ret = (ForumTopic) session.get(ForumTopic.class, id); log.debug("findTopicByPk: {}", ret); return ret; } catch (HibernateException e) { throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 8
Source File: BookmarkDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Remove bookmarks by parent node */ public static void purgeBookmarksByNode(String nodeUuid) throws DatabaseException { log.debug("purgeBookmarksByNode({})", nodeUuid); String qs = "delete from Bookmark bm where bm.node=:uuid"; Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); Query q = session.createQuery(qs); q.setString("uuid", nodeUuid); q.executeUpdate(); HibernateUtil.commit(tx); log.debug("purgeBookmarksByNode: void"); } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 9
Source File: DatabaseMetadataDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Execute update */ public static int executeValueUpdate(String query) throws DatabaseException { log.debug("executeValueUpdate({})", query); Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); Query q = session.createQuery(query); int ret = q.executeUpdate(); HibernateUtil.commit(tx); log.debug("executeValueUpdate: {}", ret); return ret; } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 10
Source File: BIMetaModelParameterDAOHibImpl.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
@Override public BIMetaModelParameter loadBIMetaModelParameterById(Integer id) { BIMetaModelParameter metaModel = null; Session session = null; Transaction transaction = null; try { session = getSession(); transaction = session.beginTransaction(); SbiMetaModelParameter sbiMetaModel = (SbiMetaModelParameter) session.load(SbiMetaModelParameter.class, id); if (sbiMetaModel != null) metaModel = toBIMetaModelParameter(sbiMetaModel); transaction.commit(); } catch (HibernateException he) { logException(he); if (transaction != null) transaction.rollback(); throw new SpagoBIRuntimeException(he.getMessage(), he); } finally { if (session != null) { if (session.isOpen()) session.close(); } } return metaModel; }
Example 11
Source File: QueryParamsDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Delete */ public static void delete(long qpId) throws DatabaseException { log.debug("delete({})", qpId); Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); QueryParams qp = (QueryParams) session.load(QueryParams.class, qpId); session.delete(qp); HibernateUtil.commit(tx); } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } log.debug("delete: void"); }
Example 12
Source File: DatabaseMetadataDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Find all wiki pages */ @SuppressWarnings("unchecked") public static List<DatabaseMetadataType> findAllTypes(String table) throws DatabaseException { log.debug("findAllTypes({})", table); String qs = "from DatabaseMetadataType dmt where dmt.table=:table order by dmt.id asc"; Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); Query q = session.createQuery(qs); q.setString("table", table); List<DatabaseMetadataType> ret = q.list(); HibernateUtil.commit(tx); log.debug("findAllTypes: {}", ret); return ret; } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 13
Source File: CronTabDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Set begin time */ public static void setLastBegin(long ctId) throws DatabaseException { log.debug("setLastBegin({})", ctId); Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); CronTab ct = (CronTab) session.load(CronTab.class, ctId); ct.setLastBegin(Calendar.getInstance()); session.update(ct); HibernateUtil.commit(tx); } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } log.debug("setLastBegin: void"); }
Example 14
Source File: ProposedQueryDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Mark proposed as accepted */ public static void markAccepted(long pqId) throws DatabaseException { log.debug("markAccepted({})", pqId); String qs = "update ProposedQueryReceived ps set ps.accepted=:accepted where ps.id=:id"; Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); Query q = session.createQuery(qs); q.setLong("id", pqId); q.setBoolean("accepted", true); q.executeUpdate(); log.debug("markAccepted: void"); } catch (HibernateException e) { throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 15
Source File: ForumDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Find all forums */ @SuppressWarnings("unchecked") public static List<Forum> findAll() throws DatabaseException { log.debug("findAll({})"); String qs = "from Forum frm order by frm.date asc"; Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); Query q = session.createQuery(qs); List<Forum> ret = q.list(); log.debug("findAll: {}", ret); return ret; } catch (HibernateException e) { throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 16
Source File: DatabaseMetadataDAO.java From document-management-system with GNU General Public License v2.0 | 6 votes |
/** * Delete */ public static void deleteType(long dmtId) throws DatabaseException { log.debug("deleteType({})", dmtId); Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); DatabaseMetadataType emt = (DatabaseMetadataType) session.load(DatabaseMetadataType.class, dmtId); session.delete(emt); HibernateUtil.commit(tx); } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } log.debug("deleteType: void"); }
Example 17
Source File: DocumentExpirationServlet.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Group List */ @SuppressWarnings("unchecked") private void groupList(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException, PrincipalAdapterException { log.debug("groupList({}, {})", new Object[]{request, response}); ServletContext sc = getServletContext(); String qs = "select distinct (dmv.col00) from DatabaseMetadataValue dmv where dmv.table='group' order by dmv.col00"; org.hibernate.Session dbSession = null; Transaction tx = null; try { dbSession = HibernateUtil.getSessionFactory().openSession(); tx = dbSession.beginTransaction(); Query q = dbSession.createQuery(qs); List<String> groups = q.list(); sc.setAttribute("groups", groups); HibernateUtil.commit(tx); } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(dbSession); } sc.getRequestDispatcher("/admin/document_expiration_group_list.jsp").forward(request, response); log.debug("groupList: void"); }
Example 18
Source File: MessageBundleServiceImpl.java From sakai with Educational Community License v2.0 | 5 votes |
protected int executeCountQuery(String query) { Long count; try { count = (Long) sessionFactory.getCurrentSession().createQuery(query).uniqueResult(); } catch (HibernateException e) { throw new RuntimeException(e.getMessage(), e); } return count.intValue(); }
Example 19
Source File: ForumDAO.java From document-management-system with GNU General Public License v2.0 | 5 votes |
/** * Remove forum topics by parent node */ @SuppressWarnings("unchecked") public static void purgeTopicsByNode(String nodeUuid) throws DatabaseException { log.debug("purgeTopicsByNode({})", nodeUuid); String qs = "from ForumTopic ft where ft.node=:uuid"; Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); Query q = session.createQuery(qs); q.setString("uuid", nodeUuid); for (ForumTopic ft : (List<ForumTopic>) q.list()) { session.delete(ft); } HibernateUtil.commit(tx); log.debug("purgeTopicsByNode: void"); } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
Example 20
Source File: HibernateSystemException.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Create a new HibernateSystemException, * wrapping an arbitrary HibernateException. * @param cause the HibernateException thrown */ public HibernateSystemException(HibernateException cause) { super(cause != null ? cause.getMessage() : null, cause); }