Example usage for org.hibernate LockMode NONE

List of usage examples for org.hibernate LockMode NONE

Introduction

In this page you can find the example usage for org.hibernate LockMode NONE.

Prototype

LockMode NONE

To view the source code for org.hibernate LockMode NONE.

Click Source Link

Document

No lock required.

Usage

From source file:com.sapienter.jbilling.server.util.db.AbstractDAS.java

License:Open Source License

/**
 * Places the DTO in the session without updates or version checkes.
 * You have to make sure that the DTO has not been modified to use this
 * @param dto/*from  w  w w  . j  a  v  a 2  s  . c o m*/
 */
public void reattachUnmodified(T dto) {
    getSession().lock(dto, LockMode.NONE);
}

From source file:com.senacor.core.manager.BaseManagerImpl.java

License:Apache License

protected <A extends BusinessObject> A reattach(final A objectToLock) {
    getSession().lock(objectToLock, LockMode.NONE);
    return objectToLock;
}

From source file:de.forsthaus.backend.dao.impl.HibernateStatisticsDaoImpl.java

License:Open Source License

@Override
public void initDetails(HibernateStatistics hibernateStatistics) {
    getHibernateTemplate().lock(hibernateStatistics, LockMode.NONE);
    initialize(hibernateStatistics.getHibernateEntityStatisticsSet());
}

From source file:de.nava.informa.utils.manager.hibernate.HibernateUtil.java

License:Open Source License

/**
 * Makes a try to lock object. This will save us great number of SQL statements
 * in several cases. It's not a big problem if locking is not possible.
 *
 * @param o object to lock.//from   ww  w  .jav  a2s .  c o  m
 * @param s session to lock object in.
 */
public static void lock(Object o, Session s) {
    try {
        s.lock(o, LockMode.NONE);
    } catch (HibernateException e) {
        // Well, it's possible that object is dirty.
    }
}

From source file:de.tudarmstadt.ukp.wikipedia.api.Category.java

License:Apache License

/**
 * This returns the internal id. Do not confuse this with the pageId.
 * @return Returns the internal id./* www . java2  s. co m*/
 */
public long __getId() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    long id = hibernateCategory.getId();
    session.getTransaction().commit();
    return id;
}

From source file:de.tudarmstadt.ukp.wikipedia.api.Category.java

License:Apache License

/**
 * Returns a unique page id.//from w  w w . j  a v a2s .  c o m
 * @return A unique page id.
 */
public int getPageId() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    int pageID = hibernateCategory.getPageId();
    session.getTransaction().commit();
    return pageID;
}

From source file:de.tudarmstadt.ukp.wikipedia.api.Category.java

License:Apache License

/**
 * Returns a set containing parents (supercategories) of this category.
 * @return A set containing parents (supercategories) of this category.
 */// w  w w  .  j a  va2  s .c  o m
public Set<Category> getParents() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    Set<Integer> tmpSet = new HashSet<Integer>(hibernateCategory.getInLinks());
    session.getTransaction().commit();

    Set<Category> categories = new HashSet<Category>();
    for (int pageID : tmpSet) {
        categories.add(this.wiki.getCategory(pageID));
    }
    return categories;
}

From source file:de.tudarmstadt.ukp.wikipedia.api.Category.java

License:Apache License

/**
 * @return A set containing the IDs of the parents of this category.
 *//*from ww  w .j av  a 2  s  .  c  o  m*/
public Set<Integer> getParentIDs() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    Set<Integer> tmpSet = new HashSet<Integer>(hibernateCategory.getInLinks());
    session.getTransaction().commit();
    return tmpSet;
}

From source file:de.tudarmstadt.ukp.wikipedia.api.Category.java

License:Apache License

/**
 * Returns a set containing the children (subcategories) of this category.
 * @return A set containing the children (subcategories) of this category.
 *//*from  w ww. java2  s. co  m*/
public Set<Category> getChildren() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    Set<Integer> tmpSet = new HashSet<Integer>(hibernateCategory.getOutLinks());
    session.getTransaction().commit();

    Set<Category> categories = new HashSet<Category>();
    for (int pageID : tmpSet) {
        categories.add(this.wiki.getCategory(pageID));
    }
    return categories;
}

From source file:de.tudarmstadt.ukp.wikipedia.api.Category.java

License:Apache License

/**
 * @return A set containing the IDs of the children of this category.
 *//*from   ww  w . j a v  a2 s.c  om*/
public Set<Integer> getChildrenIDs() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    Set<Integer> tmpSet = new HashSet<Integer>(hibernateCategory.getOutLinks());
    session.getTransaction().commit();
    return tmpSet;
}