Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.HibernateTemplate


        try {
            sessionFactoryBean.afterPropertiesSet();
        } catch (Exception e) {
            throw new RuntimeException("Could not set up database connection", e);
        }
        hibernateTemplate = new HibernateTemplate((SessionFactory) sessionFactoryBean.getObject());
    }
View Full Code Here


            if (object == null) {
                throw JournalException.wrapperException(new IllegalArgumentException(Messages.Error.IAE_NULL));
            }
        }

        final HibernateTemplate hibernateTemplate = getHibernateTemplate();
        try {
            hibernateTemplate.deleteAll(listObj);
            hibernateTemplate.flush();
        } catch (final HibernateOptimisticLockingFailureException holfe) {
            throw new JournalException(Messages.Error.JE_OBJ_MISS_ERR, holfe);
        } catch (final DataIntegrityViolationException exception) {
            throw new JournalException(exception.getMessage(), exception.getCause().getCause());//NOPMD Wrap internal exception with client exception.
        }
View Full Code Here

        if (object == null) {
            throw JournalException.wrapperException(new IllegalArgumentException(
                    "Developer Error.  Cannot delete null object"));
        }

        final HibernateTemplate hibernateTemplate = getHibernateTemplate();

        long pkeyId;
        final String fieldName = (String) BeanUtils.getProperty(object, "primaryKeyField");
        pkeyId = (Long) BeanUtils.getProperty(object, fieldName);

        if (hibernateTemplate.get(getTargetClass(), pkeyId) == null) {
            throw new JournalException("Error deleting non-existent entity.");
        }

        hibernateTemplate.delete(object);
        hibernateTemplate.flush();
    }
View Full Code Here

        if (object == null) {
            throw JournalException.wrapperException(new IllegalArgumentException(Messages.Error.IAE_NULL));
        }

        try {
            final HibernateTemplate hibernateTemplate = getHibernateTemplate();
            hibernateTemplate.saveOrUpdate(object);
            hibernateTemplate.flush();
        } catch (final HibernateSystemException hse) {
            LOGGER.error(hse.getMessage());
        } catch (final DataAccessException dae) {
            final Throwable cause = dae.getCause();
            if (cause.getClass().equals(org.hibernate.StaleStateException.class)) {
View Full Code Here

      throw new ImpossibileLeggereDettagliCausaleException();
    }
  }

  public long staccaNumeroArticolo() throws ImpossibileGenerareNumeroArticoloException {
    HibernateTemplate hibernateTemplate = getHibernateTemplate();
    Long execute = 0l;
    try {
      execute = (Long) hibernateTemplate.execute(new HibernateCallback() {
        public Object doInHibernate(Session session) {
          BigDecimal nextVal = (BigDecimal) session.createSQLQuery("select SQ_ARTICOLI.NEXTVAL from DUAL")
              .uniqueResult();
          return nextVal.longValue();
        }
View Full Code Here

        idMovimentoContabileInserito.getProgressivoRigaArticolo());

  }

  public long staccaNumeroArticoloCustom() throws ImpossibileGenerareNumeroArticoloCustomException {
    HibernateTemplate hibernateTemplate = getHibernateTemplate();
    Long execute = 0l;
    try {
      execute = (Long) hibernateTemplate.execute(new HibernateCallback() {
        public Object doInHibernate(Session session) {
          BigDecimal nextVal = (BigDecimal) session.createSQLQuery(
              "select SQ_MOVCONT_" + legalEntity + "_" + organizationUnit + ".NEXTVAL from DUAL")
              .uniqueResult();
          return nextVal.longValue();
View Full Code Here

    }

  }

  public long staccaNumeroFattura() throws ImpossibileGenerareNumeroFatturaException {
    HibernateTemplate hibernateTemplate = getHibernateTemplate();
    Long execute = 0l;
    try {
      execute = (Long) hibernateTemplate.execute(new HibernateCallback() {
        public Object doInHibernate(Session session) {
          BigDecimal nextVal = (BigDecimal) session.createSQLQuery("select SQ_FATTURE.NEXTVAL from DUAL")
              .uniqueResult();
          return nextVal.longValue();
        }
View Full Code Here

    return leggiTestataFatturaById(idTestataFatturaInserita.longValue());

  }

  public long staccaNumeroFatturaCustom() throws ImpossibileGenerareNumeroFatturaCustomException {
    HibernateTemplate hibernateTemplate = getHibernateTemplate();
    Long execute = 0l;
    try {
      execute = (Long) hibernateTemplate.execute(new HibernateCallback() {
        public Object doInHibernate(Session session) {
          BigDecimal nextVal = (BigDecimal) session.createSQLQuery(
              "select SQ_TESTATA_FATTURA_" + legalEntity + "_" + organizationUnit + ".NEXTVAL from DUAL")
              .uniqueResult();
          return nextVal.longValue();
View Full Code Here

      throw new ImpossibileLeggereCausaleMovimentoLegaleException();
    }
  }

  public long staccaNumeroMovimentoLegale() throws ImpossibileGenerareChiaveMovimentoLegaleException {
    HibernateTemplate hibernateTemplate = getHibernateTemplate();
    Long execute = 0l;
    try {
      execute = (Long) hibernateTemplate.execute(new HibernateCallback() {
        public Object doInHibernate(Session session) {
          BigDecimal nextVal = (BigDecimal) session.createSQLQuery("select movleg_num.nextval from DUAL")
              .uniqueResult();
          return nextVal.longValue();
        }
View Full Code Here

    return nuovoConto;

  }

  public long staccaNumeroConto() throws ImpossibileGenerareNumeroContoException {
    HibernateTemplate hibernateTemplate = getHibernateTemplate();
    Long execute = 0l;
    try {
      execute = (Long) hibernateTemplate.execute(new HibernateCallback() {
        public Object doInHibernate(Session session) {
          BigDecimal nextVal = (BigDecimal) session.createSQLQuery("select SQ_CONTI.NEXTVAL from DUAL")
              .uniqueResult();
          return nextVal.longValue();
        }
View Full Code Here

TOP

Related Classes of org.springframework.orm.hibernate3.HibernateTemplate

Copyright © 2018 www.massapicom. 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.