Package org.hibernate.cfg

Examples of org.hibernate.cfg.AnnotationConfiguration$ExtendedMappingsImpl


   * create a new database session
   * @throws Exception
   */
  public void createNewSession() throws Exception
  {
    configuration = new AnnotationConfiguration();
    configuration.setProperty("hibernate.connection.url", "jdbc:postgresql://" + this.url + ":" + port + "/" + this.dbname);
    configuration.setProperty("hibernate.connection.username", this.username);
    configuration.setProperty("hibernate.connection.password", this.password);
    this.sessionFactory = configuration.configure().buildSessionFactory();
    this.session = this.sessionFactory.getCurrentSession();
View Full Code Here


   *
   */
  HibernateUtil() {
    _classes = new ArrayList<Class<?>>();
    try {
      _config = new AnnotationConfiguration();
      final SAXReader r = new SAXReader();
      final InputStream cfgXml = this.getClass().getResourceAsStream("hibernate.cfg.xml");
      final Document x = new DOMWriter().write(r.read(cfgXml));
      _config.configure(x);
      configConnection();
View Full Code Here



    public static Session getNewSession() {
        if(session == null){
            session = new AnnotationConfiguration().configure().buildSessionFactory();
        }
        return session.openSession();
    }
View Full Code Here

  @Override
  public void init() {
    log.debug("init");
    if( authenticationService == null ) {
      authenticationService = new AuthenticationService();
      sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
      resourceFactory = new HrResourceFactory(sessionFactory);     
      checkInitialData();
    }
  }
View Full Code Here

public class HibernateManagerTest extends TestCase {

  public void testManagerFactory() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
View Full Code Here

      assertNotNull(poll);
  }
 
  public void testPk() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
View Full Code Here

      assertEquals(1L, manager.getPk(poll));
  }
 
  public void testSearch() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
View Full Code Here

  }
 
  public void testPropertySearch() throws Exception {
    Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
View Full Code Here

      assertEquals(2, choiceManager.filterByProperty("id__gt", "votes").count());
  }
 
  public void testMultipleJoinSearches() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
View Full Code Here

      assertEquals(0, qs.count());
  }
 
  public void testMultipleJoins() throws Exception {
      Injector injector = Guice.createInjector(new HibernateModule());
    AnnotationConfiguration cfg = injector.getInstance(HibernateUtil.class).getConfiguration();   
    new SchemaExport(cfg).drop(false, true);
    new SchemaExport(cfg).create(false, true);
   
      Managers managers = injector.getInstance(Managers.class);     
     
View Full Code Here

TOP

Related Classes of org.hibernate.cfg.AnnotationConfiguration$ExtendedMappingsImpl

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.