Example usage for org.hibernate Session flush

List of usage examples for org.hibernate Session flush

Introduction

In this page you can find the example usage for org.hibernate Session flush.

Prototype

void flush() throws HibernateException;

Source Link

Document

Force this session to flush.

Usage

From source file:com.balero.models.CommentsDAO.java

License:Open Source License

@Transactional
public void make() {
    Session session = sessionFactory.getCurrentSession();
    Comments comments = new Comments();
    comments.setId(1);//from   ww  w  .ja v a2 s.c o m
    comments.setCommentname("anonymous");
    comments.setCommentname("Great CMS. :-)");
    comments.setCommentdate(new Date());
    comments.setCommentpostid(1);
    session.save(comments);
    session.flush();
}

From source file:com.balero.models.FooterDAO.java

License:Open Source License

@Transactional
public void updateFooter(int id, String footercontent) {
    Session session = sessionFactory.openSession();
    Footer footer = new Footer();
    footer.setId(id);/*from  ww w  .  j a v a  2 s . co m*/
    footer.setFootercontent(footercontent);
    session.update(footer);
    session.flush();
    session.close();
}

From source file:com.balero.models.FooterDAO.java

License:Open Source License

@Transactional
public void make() {
    Session session = sessionFactory.getCurrentSession();
    Footer footer = new Footer();
    footer.setId(1);//w  w w.  j ava2 s  .c  om
    footer.setFootercontent(
            "Copyright (c) 2013-2014 <a href=\"http://www.balerocms.com/\">BaleroCMS Enterprise</a>.");
    session.save(footer);
    session.flush();
}

From source file:com.balero.models.SettingsDAO.java

License:Open Source License

@Transactional
public void save(long id, String sitename, String slogan, String url, String navbar) {
    Session session = sessionFactory.getCurrentSession();
    Settings settings = new Settings();
    settings.setId(id);/*from  ww w  .  j av  a2  s.c om*/
    settings.setSitename(sitename);
    settings.setSlogan(slogan);
    settings.setUrl(url);
    settings.setNavbar(navbar);
    session.update(settings);
    session.flush();
}

From source file:com.balero.models.SettingsDAO.java

License:Open Source License

@Transactional
public void make() {
    Session session = sessionFactory.getCurrentSession();
    Settings settings = new Settings();
    settings.setId(1);/*from  www.  j a  v a2s  .  c o m*/
    settings.setSitename("Balero CMS");
    settings.setSlogan("Simple is powerful");
    settings.setUrl("http://www.balerocms.com/");
    settings.setNavbar("navbar navbar-default navbar-static-top");
    session.save(settings);
    session.flush();
}

From source file:com.balero.models.StaticPagesDAO.java

License:Open Source License

@Transactional
public void addPage(String pagename, String pagebody, String pageslug, Locale pagelocale) {
    Session session = sessionFactory.openSession();
    StaticPages staticPages = new StaticPages();
    staticPages.setPagename(pagename);/*from ww w.j a  v  a2 s  .  c o m*/
    staticPages.setPagebody(pagebody);
    staticPages.setPageslug(pageslug);
    staticPages.setPagelocale(pagelocale.toString());
    session.save(staticPages);
    session.flush();
    session.close();
}

From source file:com.balero.models.StaticPagesDAO.java

License:Open Source License

@Transactional
public void updatePage(int id, String pagename, String pagebody, String pageslug, String pagelocale) {
    Session session = sessionFactory.openSession();
    StaticPages staticPages = new StaticPages();
    staticPages.setId(id);/* w  w w.  j  ava 2 s  .c  o  m*/
    staticPages.setPagename(pagename);
    staticPages.setPagebody(pagebody);
    staticPages.setPageslug(pageslug);
    staticPages.setPagelocale(pagelocale);
    session.update(staticPages);
    session.flush();
    session.close();
}

From source file:com.balero.models.StaticPagesDAO.java

License:Open Source License

/**
 * DELETE FROM query//from w  w  w  . j  a v a  2s.  co  m
 *
 * @param id
 */
@Transactional
public void deletePage(int id) {
    Session session = sessionFactory.openSession();
    StaticPages staticPages = new StaticPages();
    staticPages.setId(id);
    session.delete(staticPages);
    session.flush();
    session.close();
}

From source file:com.balero.models.StaticPagesDAO.java

License:Open Source License

@Transactional
public void make(Locale locale) {
    Session session = sessionFactory.getCurrentSession();
    StaticPages staticPages = new StaticPages();
    staticPages.setId(1);/*ww w .j av  a2 s. com*/
    staticPages.setPagename("Example");
    staticPages.setPagebody("\n"
            + "<p>Lorem Ipsum is text that is commonly used in graphic design typefaces demonstrations or draft design to test the visual design before inserting the final text.</p>\n"
            + "\n"
            + "<p>Although currently has no sources to justify tesis hip, professor of classical philology Richard McClintock says its use dates back to the early printers XVI.1 century Its use in some text editors well known in today has given the new popularity lorem ipsum.</p>\n"
            + "\n"
            + "<p>The text itself no sense, although it is not completely random, but derives from a text by Cicero in Latin language, whose words have been removed them syllables or letters. The meaning of the text does not matter, since it is just a test demostracino,</p>\n");
    staticPages.setPageslug("example-page");
    staticPages.setPagelocale(locale.toString());
    session.save(staticPages);
    session.flush();
}

From source file:com.balero.models.TestDAO.java

License:Open Source License

@Transactional
public void add() {
    Session session = sessionFactory.openSession();
    Test test = new Test();
    Double n = Math.random();
    test.setName("user_" + n.toString());
    test.setEmail("user@" + n.toString());
    session.save(test);/*from   w w w .  ja v  a  2  s.  c o  m*/
    session.flush();
    session.close();
}