Package org.hibernate.cfg

Examples of org.hibernate.cfg.AnnotationConfiguration.configure()


  private SessionFactory _sessionFactory;

  @Before
  public void setup() {
    Configuration config = new AnnotationConfiguration();
    config = config.configure("org/onebusaway/geocoder/impl/hibernate-configuration.xml");
    _sessionFactory = config.buildSessionFactory();
  }

  @After
  public void tearDown() {
View Full Code Here


  public void setup() throws IOException {

    _dao = new UserReportingDaoImpl();

    Configuration config = new AnnotationConfiguration();
    config = config.configure("org/onebusaway/transit_data_federation/hibernate-configuration.xml");
    _sessionFactory = config.buildSessionFactory();

    _dao.setSessionFactory(_sessionFactory);
  }
View Full Code Here

  @Before
  public void setup() throws IOException {

    Configuration config = new AnnotationConfiguration();
    config = config.configure("org/onebusaway/users/hibernate-configuration.xml");
    _sessionFactory = config.buildSessionFactory();

    _dao = new UserDaoImpl();
    _dao.setSessionFactory(_sessionFactory);
  }
View Full Code Here

  }

  @PostConstruct
  public void create() {
    Configuration configuration = new AnnotationConfiguration();
    configuration = configuration.configure(getHibernateCfgLocation());
    factory = configuration.buildSessionFactory();
  }

  public SessionFactory getInstance() {
    return factory;
View Full Code Here

         }
      }
      // hibernate.cfg.xml configuration
      if (cfgProperties==null && cfgResourceName==null)
      {
         configuration.configure();
      }
      else if (cfgProperties==null && cfgResourceName!=null)
      {
         configuration.configure(cfgResourceName);
      }
View Full Code Here

      {
         configuration.configure();
      }
      else if (cfgProperties==null && cfgResourceName!=null)
      {
         configuration.configure(cfgResourceName);
      }
      // Mapping metadata
      if (mappingClasses!=null)
      {
         for (String className: mappingClasses)
View Full Code Here

            properties.load(DbBean.getResourceAsStream("postila.properties"));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        AnnotationConfiguration config = new AnnotationConfiguration();
        config.configure("hibernate.cfg.xml");
        sf = config.buildSessionFactory();
    }
    public void dispose() {
        if(!sf.isClosed()){
            sf.close();
View Full Code Here

            properties.load(DbBean.getResourceAsStream("postila.properties"));
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        AnnotationConfiguration config = new AnnotationConfiguration();
        config.configure("hibernate.cfg.xml");
        sf = config.buildSessionFactory();
        sess = sf.openSession();
        //tx = sess.beginTransaction();
    }
   
View Full Code Here

public class MainClass {
  public static void main(String[] args) {
    try {
      AnnotationConfiguration cfg = new AnnotationConfiguration();
      cfg.configure("hibernate.cfg.xml");
      SessionFactory sessionFactory = cfg.buildSessionFactory();
      Session session = sessionFactory.openSession();
      Transaction tx = session.beginTransaction();
      tx.commit();
      session.close();
View Full Code Here

        return new PF().autenticar(usuario, senha);
    }

    private static void GerarTabelas() {
        AnnotationConfiguration cfg = new AnnotationConfiguration();
        cfg.configure("hibernate.cfg.xml");
        SchemaExport sx = new SchemaExport(cfg);
        sx.create(true, true);
    }

    private static void excluindo() {
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.