Package org.hibernate

Examples of org.hibernate.Transaction.begin()


  public void doSave(final Group 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);
    }
View Full Code Here


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

  public void doDelete(final Group t) throws DataNotRemovedException {
    final Session session = this.hibernateTemplate.getSessionFactory()
        .openSession();
    final Transaction transaction = session.getTransaction();
    try {
      transaction.begin();
      session.delete(t);
      transaction.commit();
    } catch (final HibernateException e) {
      LOGGER.error(e);
    }
View Full Code Here

  }

  public Transaction beginTransaction() throws HibernateException {
    errorIfClosed();
    Transaction result = getTransaction();
    result.begin();
    return result;
  }

  public EntityPersister getEntityPersister(final String entityName, final Object object) {
    errorIfClosed();
View Full Code Here

    public void salvarTipoDeficiencia(TipoDeficiencia df){
        Session session = factory.openSession();
        Transaction trans = session.beginTransaction();

        trans.begin();

        session.save(df);

        trans.commit();
        session.close();
View Full Code Here

    public void deletarTipoDeficiencia(int cod){
        Session session = factory.openSession();
        Transaction trans = session.beginTransaction();

        trans.begin();

        TipoDeficiencia df = pesquisarTipoDeficienciaPorCodigo(cod);
        session.delete(df);

        trans.commit();
View Full Code Here

    public void deletarTipoDeficienciaPorObj(TipoDeficiencia df){
        Session session = factory.openSession();
        Transaction trans = session.beginTransaction();

        trans.begin();

        session.delete(df);

        trans.commit();
        session.close();
View Full Code Here

    public void alterarTipoDeficiencia(TipoDeficiencia df){
        Session session = factory.openSession();
        Transaction trans = session.beginTransaction();

        trans.begin();

        TipoDeficiencia df2 = pesquisarTipoDeficienciaPorCodigo(df.getCodTipoDeficiencia());
        df.setCodTipoDeficiencia(df2.getCodTipoDeficiencia());
        session.update(df);
View Full Code Here

    public void salvarTipoSitOcupacional(TipoSitOcupacional to){
        Session session = factory.openSession();
        Transaction trans = session.beginTransaction();

        trans.begin();

        session.save(to);

        trans.commit();
        session.close();
View Full Code Here

    public void deletarTipoSitOcupacional(int cod){
        Session session = factory.openSession();
        Transaction trans = session.beginTransaction();

        trans.begin();

        TipoSitOcupacional to = pesquisarTipoSitOcupacionalPorCodigo(cod);
        session.delete(to);

        trans.commit();
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.