Package org.hibernate

Examples of org.hibernate.Transaction.begin()


  public void doDelete(final BasketsBatch t) throws DataNotRemovedException {
    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();
    try {
      transaction.begin();
      final Query query = session.createQuery(UPDATE_BATCH_FOR_BASKETS)
          .setLong(0, t.getId());
      query.executeUpdate();
      session.delete(t);
      transaction.commit();
View Full Code Here


  @Override
  public void doSave(final Payer t) throws DataNotStoredException {
    final Transaction transaction = getTransaction();
    try {
      transaction.begin();
      this.hibernateTemplate.save(t);
      transaction.commit();
    } catch (final HibernateException e) {
      transaction.rollback();
      LOGGER.error(e);
View Full Code Here

      throws DataNotRemovedException {
    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = getTransaction();
    try {
      transaction.begin();
      for (final Payer payer : payersToDelete) {
        session.createQuery(DELETE_FROM_PAYER_WHERE_ID)
            .setLong(0, payer.getId()).executeUpdate();
      }
      transaction.commit();
View Full Code Here

  public void doSave(final Purchase t) throws DataNotStoredException {
    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();
    try {
      transaction.begin();
      session.save(t);
      transaction.commit();
    } catch (final HibernateException e) {
      LOGGER.error(e);
    } finally {
View Full Code Here

    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();

    try {
      transaction.begin();
      for (final Purchase purchase : purchases) {
        if (purchase != null) {
          session.saveOrUpdate(purchase);
        }
      }
View Full Code Here

    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();

    try {
      transaction.begin();
      session.createQuery(DELETE_FROM_PURCHASE).setLong(0, id)
          .executeUpdate();
      transaction.commit();
    } catch (final HibernateException e) {
      LOGGER.error(e);
View Full Code Here

    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();

    try {
      transaction.begin();
      for (final Purchase purchase : purchases) {
        if (purchase != null) {
          session.createQuery(DELETE_FROM_PURCHASE)
              .setLong(0, purchase.getId()).executeUpdate();
        }
View Full Code Here

  public void doSave(final Basket t) throws DataNotStoredException {
    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();
    try {
      transaction.begin();
      session.saveOrUpdate(t);
      transaction.commit();
    } catch (final HibernateException e) {
      LOGGER.error(e);
      throw new DataNotStoredException(
View Full Code Here

      throws DataNotRemovedException {
    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();
    try {
      transaction.begin();
      for (final Basket basket : baskets) {
        session.delete(basket);
      }
      transaction.commit();
    } catch (final HibernateException e) {
View Full Code Here

  public void doDeleteById(final Long id) {
    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();
    try {
      transaction.begin();
      session.createQuery(DELETE_FROM_BASKET_WHERE_ID).setLong(0, id)
          .executeUpdate();
      transaction.commit();
    } catch (final HibernateException e) {
      LOGGER.error(e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.