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:de.tudarmstadt.ukp.wikipedia.api.Category.java

License:Apache License

/**
 * Returns the title of the category.//from   www  .ja v  a  2s  .  c o  m
 * @return The title of the category.
 * @throws WikiTitleParsingException
 */
public Title getTitle() throws WikiTitleParsingException {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    String name = hibernateCategory.getName();
    session.getTransaction().commit();
    Title title = new Title(name);
    return title;
}

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

License:Apache License

/**
 * Returns the set of pages that are categorized under this category.
 * @return The set of pages that are categorized under this category.
 * @throws WikiApiException//  w  w  w . j a v a 2 s  .co  m
 * @deprecated Use {@link #getArticles()} instead.
 */
@Deprecated
public Set<Page> getPages() throws WikiApiException {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    Set<Integer> tmpSet = new HashSet<Integer>(hibernateCategory.getPages());
    session.getTransaction().commit();

    Set<Page> pages = new HashSet<Page>();
    for (int pageID : tmpSet) {
        pages.add(this.wiki.getPage(pageID));
    }
    return pages;
}

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

License:Apache License

/**
 * Returns the set of articles that are categorized under this category.
 * @return The set of articles that are categorized under this category.
 * @throws WikiApiException//from  w w w .ja v  a 2  s  .  c  om
 */
public Set<Page> getArticles() throws WikiApiException {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    Set<Integer> tmpSet = new HashSet<Integer>(hibernateCategory.getPages());
    session.getTransaction().commit();

    Set<Page> pages = new HashSet<Page>();
    for (int pageID : tmpSet) {
        pages.add(this.wiki.getPage(pageID));
    }
    return pages;
}

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

License:Apache License

/**
 * Returns the set of article ids that are categorized under this category.
 * @return The set of article ids that are categorized under this category.
 * @throws WikiApiException/*ww  w. j  a v a 2s.co m*/
 */
public Set<Integer> getArticleIds() throws WikiApiException {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    Set<Integer> tmpSet = new HashSet<Integer>(hibernateCategory.getPages());
    session.getTransaction().commit();

    return tmpSet;
}

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

License:Apache License

/**
 * This method exposes implementation details and should not be made public.
 * It is used for performance tuning./*from  w  w w  .j  a  va 2s  .  co  m*/
 * @return The set of pages that are categorized under this category.
 * @throws WikiPageNotFoundException
 */
protected Set<Integer> __getPages() throws WikiPageNotFoundException {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateCategory, LockMode.NONE);
    Set<Integer> tmpSet = new HashSet<Integer>(hibernateCategory.getPages());
    session.getTransaction().commit();
    return tmpSet;
}

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

License:Apache License

/**
 * Returns the id of the MetaData object.
 *
 * @return The id of the MetaData object.
 *///from ww w .ja  va 2 s  .com
public long getId() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateMetaData, LockMode.NONE);
    long id = hibernateMetaData.getId();
    session.getTransaction().commit();
    return id;
}

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

License:Apache License

/**
 * Returns the number of categories in the current Wikipedia.
 *
 * @return The number of categories in the current Wikipedia.
 *//*from  www  .j a  v  a  2  s .  co  m*/
public long getNumberOfCategories() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateMetaData, LockMode.NONE);
    long nrofCategories = hibernateMetaData.getNrofCategories();
    session.getTransaction().commit();
    return nrofCategories;
}

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

License:Apache License

/**
 * Returns the number of pages in the current Wikipedia.
 *
 * @return The number of pages in the current Wikipedia.
 *//*from  ww  w.java2s  . c  om*/
public long getNumberOfPages() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateMetaData, LockMode.NONE);
    long nrofPages = hibernateMetaData.getNrofPages();
    session.getTransaction().commit();
    return nrofPages;
}

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

License:Apache License

/**
 * Returns the number of disambituation pages in the current Wikipedia.
 *
 * @return The number of disambituation pages in the current Wikipedia.
 *//* ww w  . ja v  a  2s.  co m*/
public long getNumberOfDisambiguationPages() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateMetaData, LockMode.NONE);
    long nrofDisambPages = hibernateMetaData.getNrofDisambiguationPages();
    session.getTransaction().commit();
    return nrofDisambPages;
}

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

License:Apache License

/**
 * Returns the number of redirects in the current Wikipedia.
 *
 * @return The number of redirects in the current Wikipedia.
 *///from   w w w  . j ava  2s  .  c om
public long getNumberOfRedirectPages() {
    Session session = this.wiki.__getHibernateSession();
    session.beginTransaction();
    session.lock(hibernateMetaData, LockMode.NONE);
    long nrofRedirects = hibernateMetaData.getNrofRedirects();
    session.getTransaction().commit();
    return nrofRedirects;
}