List of usage examples for com.liferay.portal.kernel.dao.orm SQLQuery executeUpdate
public int executeUpdate() throws ORMException;
From source file:com.crm.alarm.service.persistence.MonitorAccountFinderImpl.java
License:Open Source License
public void updateAccount(long userId, long accountId, String password, String actionType, String appMethod) throws SystemException, PortalException { Session session = null;// w w w . j a v a 2s .c o m try { if (Validator.isNull(appMethod)) { return; } String customSQL = "{call " + appMethod + "(?, ?, ?, ?)}"; session = openSession(); SQLQuery query = session.createSQLQuery(customSQL); query.setLong(0, userId); query.setLong(1, accountId); query.setString(2, password); query.setString(3, actionType); query.executeUpdate(); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.linkshortener.service.impl.LinkLocalServiceImpl.java
License:Open Source License
/** * Deletes all the Links that were not modified after the specified date. * * @param olderThen boundary date for the deletion. *//*from www .j a va2 s . co m*/ @Override @Transactional(isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW) public void deleteOldRecords(Date olderThen) { try { Session session = linkPersistence.openSession(); String sql = CustomSQLUtil.get(_DELETE_LINKS); SQLQuery sqlQuery = session.createSQLQuery(sql); QueryPos qPos = QueryPos.getInstance(sqlQuery); Timestamp olderThenTS = CalendarUtil.getTimestamp(olderThen); qPos.add(olderThenTS); sqlQuery.executeUpdate(); linkPersistence.closeSession(session); } catch (ORMException orme) { _LOG.error("Unable to remove old Links.", orme); } }
From source file:com.liferay.portlet.css.service.persistence.CSSEntryFinderImpl.java
License:Open Source License
public void removeByPrimaryKeys(long[] cssEntryIds) throws SystemException { Session session = null;// ww w. j a v a2 s .c o m try { session = openSession(); String sql = CustomSQLUtil.get(REMOVE_BY_PRIMARY_KEYS); SQLQuery q = session.createSQLQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(cssEntryIds); q.addEntity("CE.*", CSSEntryImpl.class); q.executeUpdate(); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:org.oep.cmon.dao.hosohcc.service.persistence.HoSoTTHCCongFinderImpl.java
License:Apache License
/** * This is fucntion updateHOSOTTHCCONGById * Version: 1.0/*ww w. jav a 2s . co m*/ * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param long hoSoTTHCCongId, int status * @return int */ public int updateHOSOTTHCCONGById(long hoSoTTHCCongId, int status) throws SystemException { Session session = null; try { session = openSession(); String sql = "UPDATE CMON_HOSOTTHCCONG SET DAGUIGIAYHEN = ? WHERE ID = ?"; SQLQuery q = session.createSQLQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(status); qPos.add(hoSoTTHCCongId); return q.executeUpdate(); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:org.oep.cmon.dao.report.service.persistence.ReportThongKeFinderImpl.java
License:Apache License
/** * This is fucntion reportScheduler /*from w w w . jav a 2 s .c om*/ * Version: 1.0 * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param * @return void */ public void reportScheduler() { Session session = null; try { session = openSession(); String base = "CALL cmon_fn_rpcall_processdata()"; StringBuffer sqlBuffer = new StringBuffer(base); String sql = sqlBuffer.toString(); SQLQuery q = session.createSQLQuery(sql); q.setCacheable(false); q.executeUpdate(); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } finally { closeSession(session); } }
From source file:vn.gt.dao.noticeandmessage.service.persistence.HistoryInterfaceRequestFinderImpl.java
License:Open Source License
public int updateHistoryInterfaceRequest(String sql) throws SystemException { Session session = null;/*from www . j av a 2s.c o m*/ try { session = openSession(); _log.debug("=========updateByRequestCode========" + sql); SQLQuery q = session.createSQLQuery(sql); q.setCacheable(false); QueryPos qPos = QueryPos.getInstance(q); int executeUpdate = q.executeUpdate(); // session.flush(); return executeUpdate; } catch (Exception e) { e.printStackTrace(); throw new SystemException(e); } finally { closeSession(session); } }