Package org.springframework.orm.hibernate3.annotation

Examples of org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean


        super(CraningCost.class);
    }

    public final CraningCost findByRuleId(final String ruleId) {
        return (CraningCost) getHibernateTemplate().execute(
                new HibernateCallback() {

                    @SuppressWarnings("unchecked")
                    public Object doInHibernate(final Session session) {
                        List<CraningCost> list = session.createCriteria(
                                CraningCost.class).add(
View Full Code Here


     * @see no.ugland.utransprod.dao.DeviationStatusDAO#findAllNotForManager()
     */
    @SuppressWarnings("unchecked")
    public final List<DeviationStatus> findAllNotForManager() {
        return (List<DeviationStatus>) getHibernateTemplate().execute(
                new HibernateCallback() {

                    public Object doInHibernate(final Session session) {
                        return session.createCriteria(DeviationStatus.class)
                                .add(
                                        Restrictions.or(Restrictions
View Full Code Here

    }

    public final Integer countUsedByDeviation(
            final DeviationStatus deviationStatus) {
        return (Integer) getHibernateTemplate().execute(
                new HibernateCallback() {

                    public Object doInHibernate(final Session session) {
                        String sql = "select count(deviation.deviationId) "
                                + "       from Deviation deviation"
                                + "       where deviation.deviationStatus=:deviationStatus";
View Full Code Here

                });
    }

  public List<DeviationStatus> findAllForDeviation() {
     return (List<DeviationStatus>) getHibernateTemplate().execute(
                  new HibernateCallback() {

                      public Object doInHibernate(final Session session) {
                          return session.createCriteria(DeviationStatus.class)
                                  .add(
                                          Restrictions.eq("forDeviation", Integer.valueOf(1)))
View Full Code Here

        AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean();
        sessionFactory.setDataSource(dataSource);
        sessionFactory.setAnnotatedClasses(new Class[] {PhotoSpot.class});
        sessionFactory.afterPropertiesSet();

        repo.hibernate = new HibernateTemplate(sessionFactory.getObject());
    }
View Full Code Here

  public Hibernate3UserDao() {
    super();
  }

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

      if (hibernateTemplate != null)
        logger.debug("hibernateTemplate present - jBPM persistence service will be managed by Spring");
      else {
        if (dummy.getSessionFactory() != null) {
          logger.debug("creating hibernateTemplate based on jBPM SessionFactory");
          hibernateTemplate = new HibernateTemplate(dummy.getSessionFactory());
        }
        else

          logger.debug("hibernateTemplate missing - jBPM will handle its own persistence");
      }
View Full Code Here

   */
  public void afterPropertiesSet() {
    if (jbpmSessionFactory == null)
      throw new IllegalArgumentException("jbpmSessionFactory must be set");
    // init the hbTemplate that will be used to prepare and handle the HB Session
    hibernateTemplate = new HibernateTemplate(jbpmSessionFactory.getSessionFactory());
    hibernateTemplate.setAllowCreate(allowCreate);
  }
View Full Code Here

    public void setUp() throws Exception {
        dataSource = new DriverManagerDataSource("jdbc:h2:mem:hibernate;DB_CLOSE_DELAY=-1", "sa", "sa");

        System.setProperty("hibernate.dialect", H2Dialect.class.getName());
        System.setProperty("hibernate.hbm2ddl.auto", "create-drop");
        AnnotationSessionFactoryBean sessionFactory = new AnnotationSessionFactoryBean();
        sessionFactory.setDataSource(dataSource);
        sessionFactory.setAnnotatedClasses(new Class[] {PhotoSpot.class});
        sessionFactory.afterPropertiesSet();

        repo.hibernate = new HibernateTemplate(sessionFactory.getObject());
    }
View Full Code Here

        } catch (ClassNotFoundException e) {
            throw new RuntimeException("Cannot load specified JDBC driver: " + jdbcDriver, e);
        }
        DriverManagerDataSource dataSource=new DriverManagerDataSource(jdbcConnection, jdbcUser, jdbcPassword);

        AnnotationSessionFactoryBean sessionFactoryBean = new AnnotationSessionFactoryBean();
        sessionFactoryBean.setDataSource(dataSource);
        Properties config = new Properties();
        config.setProperty("hibernate.dialect", hibernateDialect);
        config.setProperty("hibernate.connection.autocommit", "true");
        config.setProperty("hibernate.hbm2ddl.auto", "update");
        sessionFactoryBean.setHibernateProperties(config);

        sessionFactoryBean.setAnnotatedClasses(new Class<?>[]{WarningRecord.class});
        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

TOP

Related Classes of org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean

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.