List of usage examples for org.hibernate LockMode NONE
LockMode NONE
To view the source code for org.hibernate LockMode NONE.
Click Source Link
From source file:org.rebioma.server.services.AscDataDbImpl.java
License:Apache License
public void attachClean(AscData instance) { log.debug("attaching clean AscData instance"); try {/* ww w . ja v a 2 s. com*/ ManagedSession.createNewSession().lock(instance, LockMode.NONE); //HibernateUtil.getCurrentSession().lock(instance, LockMode.NONE); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } }
From source file:org.rebioma.server.services.OccurrenceDbImpl.java
License:Apache License
public void attachClean(Session session, Occurrence instance) { log.debug("attaching clean Occurrence instance"); try {//from w w w . j av a 2 s . com // ManagedSession.createNewSessionAndTransaction().lock(instance, LockMode.NONE); session.lock(instance, LockMode.NONE); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } }
From source file:org.rebioma.server.services.UserDbImpl.java
License:Apache License
public void attachClean(User instance) { log.debug("attaching clean User instance"); try {/* w ww. java 2 s. c o m*/ ManagedSession.createNewSession().lock(instance, LockMode.NONE); log.debug("attach successful"); } catch (RuntimeException re) { log.error("attach failed", re); throw re; } }
From source file:org.sakaiproject.component.app.messageforums.ui.PrivateMessageManagerImpl.java
License:Educational Community License
public PrivateForum initializePrivateMessageArea(Area area, List aggregateList, String userId, String siteId) { // String userId = getCurrentUser(); aggregateList.clear();/*w w w.ja v a 2 s . co m*/ aggregateList.addAll(initializeMessageCounts(userId, siteId)); getHibernateTemplate().lock(area, LockMode.NONE); PrivateForum pf; /** create default user forum/topics if none exist */ if ((pf = forumManager.getPrivateForumByOwnerArea(userId, area)) == null) { /** initialize collections */ //getHibernateTemplate().initialize(area.getPrivateForumsSet()); pf = forumManager.createPrivateForum(getResourceBundleString(MESSAGES_TITLE), userId); //area.addPrivateForum(pf); //pf.setArea(area); //areaManager.saveArea(area); PrivateTopic receivedTopic = forumManager.createPrivateForumTopic(PVT_RECEIVED, true, false, userId, pf.getId()); PrivateTopic sentTopic = forumManager.createPrivateForumTopic(PVT_SENT, true, false, userId, pf.getId()); PrivateTopic deletedTopic = forumManager.createPrivateForumTopic(PVT_DELETED, true, false, userId, pf.getId()); PrivateTopic draftTopic = forumManager.createPrivateForumTopic(PVT_DRAFTS, true, false, userId, pf.getId()); /** save individual topics - required to add to forum's topic set */ forumManager.savePrivateForumTopic(receivedTopic, userId, siteId); forumManager.savePrivateForumTopic(sentTopic, userId, siteId); forumManager.savePrivateForumTopic(deletedTopic, userId, siteId); forumManager.savePrivateForumTopic(draftTopic); pf.addTopic(receivedTopic); pf.addTopic(sentTopic); pf.addTopic(deletedTopic); pf.addTopic(draftTopic); pf.setArea(area); PrivateForum oldForum; if ((oldForum = forumManager.getPrivateForumByOwnerAreaNull(userId)) != null) { oldForum = initializationHelper(oldForum, userId); // getHibernateTemplate().initialize(oldForum.getTopicsSet()); List pvtTopics = oldForum.getTopics(); for (int i = 0; i < pvtTopics.size(); i++)//reveived deleted sent { PrivateTopic currentTopic = (PrivateTopic) pvtTopics.get(i); if (currentTopic != null) { if (!currentTopic.getTitle().equals(PVT_RECEIVED) && !currentTopic.getTitle().equals(PVT_SENT) && !currentTopic.getTitle().equals(PVT_DELETED) && !currentTopic.getTitle().equals(PVT_DRAFTS) && area.getContextId().equals(currentTopic.getContextId())) { currentTopic.setPrivateForum(pf); forumManager.savePrivateForumTopic(currentTopic, userId, siteId); pf.addTopic(currentTopic); } } } if (oldForum.getAutoForward() != null) { pf.setAutoForward(oldForum.getAutoForward()); } if (oldForum.getAutoForwardEmail() != null) { pf.setAutoForwardEmail(oldForum.getAutoForwardEmail()); } } forumManager.savePrivateForum(pf, userId); } else { getHibernateTemplate().initialize(pf.getTopicsSet()); } return pf; }
From source file:org.seasar.hibernate3.dao.impl.LoadCommand.java
License:Apache License
public void setLockMode(String lockMode) { final String NONE = "NONE"; final String READ = "READ"; final String UPGRADE = "UPGRADE"; if (lockMode.equals(NONE)) { lockMode_ = LockMode.NONE; } else if (lockMode.equals(READ)) { lockMode_ = LockMode.READ;/*w w w . j a va 2s .c o m*/ } else if (lockMode.equals(UPGRADE)) { lockMode_ = LockMode.UPGRADE; } else { lockMode_ = null; } }
From source file:org.tynamo.hibernate.services.HibernatePersistenceServiceImpl.java
License:Apache License
public void reattach(Object model) { getSession().lock(model, LockMode.NONE); }
From source file:org.unitedinternet.cosmo.dao.hibernate.ItemDaoImpl.java
License:Apache License
protected void attachToSession(Item item) { if (getSession().contains(item)) { return; } getSession().lock(item, LockMode.NONE); }
From source file:org.webical.dao.hibernateImpl.CalendarDaoHibernateImpl.java
License:Open Source License
@Transaction(readOnly = false) public void removeCalendar(Calendar calendar) throws DaoException { try {/*from w w w . j a va2 s . c o m*/ log.info("Deleting calendar " + calendar.getName()); getSession().buildLockRequest(new LockOptions(LockMode.NONE)).lock(calendar); //Cascade events in the cache EventDao eventDao = DaoFactory.getInstance().getEventDaoForCalendar(calendar); if (eventDao != null) { eventDao.removeAllEventsForCalendar(calendar); } delete(calendar); } catch (Exception e) { log.error(e, e); throw new DaoException("Could not remove Calendar", e); } }
From source file:org.webical.dao.hibernateImpl.EventDaoWebDavHibernateBufferedImpl.java
License:Open Source License
@Transaction(readOnly = false) public void removeEvent(Event event) throws DaoException { if (event == null) return;//from w ww .j av a 2 s .c o m try { if (log.isDebugEnabled()) log.debug("removeEvent: " + event.toString()); // Remove the event from the session getSession().buildLockRequest(new LockOptions(LockMode.NONE)).lock(event); delete(event); // First refresh the calendar from remote List<Event> events = refreshCalendarEvents(event.getCalendar()); // Remove the event (if still exists) Event removedEvent = null; for (Event e : events) { if (e.getUid().equals(event.getUid())) { removedEvent = e; } } // 2x ? if (removedEvent != null) { getSession().buildLockRequest(new LockOptions(LockMode.NONE)).lock(removedEvent); delete(removedEvent); //Synchronize the removed event //Create a new WebDavCalendarSynchronisation util WebDavCalendarSynchronisation calendarSynchronisation = new WebDavCalendarSynchronisation(); //Sync to the remote ics file calendarSynchronisation.writeToRemoteCalendarFile(removedEvent.getCalendar(), getAllEvents(removedEvent.getCalendar())); } } catch (Exception e) { log.error(e, e); throw new DaoException("Could not remove Event", e); } }
From source file:org.webical.dao.hibernateImpl.EventDaoWebDavHibernateBufferedImpl.java
License:Open Source License
@Transaction(readOnly = false) public void removeAllEventsForCalendar(Calendar calendar) throws DaoException { if (calendar == null) return;/*www . j a v a 2s .co m*/ if (log.isDebugEnabled()) { log.debug("Removing all events for calendar: " + calendar.getName()); } try { getSession().buildLockRequest(new LockOptions(LockMode.NONE)).lock(calendar); removeAllEvents(getEventsForCalendar(calendar)); } catch (Exception e) { log.error(e, e); throw new DaoException("Could not remove EventList", e); } }