Examples of saveOrUpdate()


Examples of org.hibernate.Session.saveOrUpdate()

     * @param change
     */
    public void saveRule(Rule rule, RuleChange change) {
        Session session1 = getHibernateTemplate().getSessionFactory().openSession();
        Transaction tx = session1.beginTransaction();
        session1.saveOrUpdate(rule);
        session1.save(change);
        tx.commit();
        session1.close();
    }
   
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();
    try {
      transaction.begin();
      session.saveOrUpdate(t);
      final List<Basket> baskets = t.getBaskets();
      for (final Basket basket : baskets) {
        basket.setBasketsBatch(t);
        session.saveOrUpdate(basket);
      }
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

      transaction.begin();
      session.saveOrUpdate(t);
      final List<Basket> baskets = t.getBaskets();
      for (final Basket basket : baskets) {
        basket.setBasketsBatch(t);
        session.saveOrUpdate(basket);
      }
      transaction.commit();
    } catch (final HibernateException e) {
      LOGGER.error(e);
      throw new DataNotStoredException(
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

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

Examples of org.hibernate.Session.saveOrUpdate()

    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(
          "Basket was not stored for a some reason", e);
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

}

@Transactional
public void save(Object object) {
Session session = provideManager();
session.saveOrUpdate(object);
}

@Transactional
public void delete(Object object) {
Session session = provideManager();
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

  public void saveOrUpdate(SystemUser systemUser) {
    Session session = (Session) em.getDelegate();
    if (systemUser.getId() == null) {
      session.persist(systemUser);
    } else {
      session.saveOrUpdate(systemUser);
    }
  }
}
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    Date timestamp2 = new Date(timestamp1.getTime() + 1);

    // persist the record
    PurchaseRecord record = new PurchaseRecord();
    record.setTimestamp(timestamp1);
    s.saveOrUpdate(record);
   
    t.commit();
    s.close();

    // test that the id was generated
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    record.setTimestamp(timestamp2);
   
    s = openSession();
    t = s.beginTransaction();

    s.saveOrUpdate(record);
   
    t.commit();
    s.close();

    // see that we get the *same* id, and the new timestamp
View Full Code Here

Examples of org.hibernate.Session.saveOrUpdate()

    Session s = openSession();
    Transaction t = s.beginTransaction();

    // persist the record
    PurchaseRecord record = new PurchaseRecord();
    s.saveOrUpdate(record);
   
    t.commit();
    s.close();

    PurchaseRecord.Id generatedId = record.getId();
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.