Examples of HibernateTemplate


Examples of org.springframework.orm.hibernate3.HibernateTemplate

     * <p>setSessionFactory</p>
     *
     * @param sessionFactory a {@link org.hibernate.SessionFactory} object.
     */
    public void setSessionFactory(SessionFactory sessionFactory) {
        m_template = new HibernateTemplate(sessionFactory);
    }
View Full Code Here

Examples of org.springframework.orm.hibernate3.HibernateTemplate

public class UserDAOHibernate implements UserDAO {

  private HibernateTemplate hibernateTemplate;

  public void setSessionFactory(SessionFactory sessionFactory) {
    this.hibernateTemplate = new HibernateTemplate(sessionFactory);
  }
View Full Code Here

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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

            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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

        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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

        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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

      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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

        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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

    }

  }

  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

Examples of org.springframework.orm.hibernate3.HibernateTemplate

    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
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.