Package org.hibernate.cfg

Examples of org.hibernate.cfg.AnnotationConfiguration$ExtendedMappingsImpl


      assertEquals(2, qs.count());
  }
 
  public void testJoinedOrderBy() 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


      qs.list(); // TODO for now just tesitng the sql output ..  make the test complete...
  }
 
  public void testDistinctEntry() 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

      // humm,  qs.count() does not work..  bug somewhere (probably limitation of hibernate).
  }

  public void testInSet() 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

        this.classNameLocator = classNameLocator;
    }

    public void configure(Configuration configuration)
    {
        AnnotationConfiguration cfg = (AnnotationConfiguration) configuration;

        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();

        for (String packageName : packageManager.getPackageNames())
        {
            cfg.addPackage(packageName);

            for (String className : classNameLocator.locateClassNames(packageName))
            {
                try
                {
                    Class entityClass = contextClassLoader.loadClass(className);

                    cfg.addAnnotatedClass(entityClass);
                }
                catch (ClassNotFoundException ex)
                {
                    throw new RuntimeException(ex);
                }
View Full Code Here

    public HibernateSessionSourceImpl(Logger logger, List<HibernateConfigurer> hibernateConfigurers)
    {
        long startTime = System.currentTimeMillis();

        configuration = new AnnotationConfiguration();

        for (HibernateConfigurer configurer : hibernateConfigurers)
            configurer.configure(configuration);

        long configurationComplete = System.currentTimeMillis();
View Full Code Here

    public HibernateSessionSourceImpl(Logger logger, List<HibernateConfigurer> hibernateConfigurers)
    {
        long startTime = System.currentTimeMillis();

        Configuration configuration = new AnnotationConfiguration();

        for(HibernateConfigurer configurer : hibernateConfigurers)
          configurer.configure(configuration);

        long configurationComplete = System.currentTimeMillis();

        _sessionFactory = configuration.buildSessionFactory();
        _configuration = new ImmutableConfiguration(configuration);

        long factoryCreated = System.currentTimeMillis();

        logger.info(HibernateMessages.startupTiming(
View Full Code Here

    }

    public void configure(Configuration configuration)
    {
        Defense.cast(configuration, AnnotationConfiguration.class, "configuration");
        AnnotationConfiguration cfg = (AnnotationConfiguration) configuration;

        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();

        for (String packageName : _packageManager.getPackageNames())
        {
            cfg.addPackage(packageName);

            for (String className : _classNameLocator.locateClassNames(packageName))
            {
                try
                {
                    Class entityClass = contextClassLoader.loadClass(className);

                    cfg.addAnnotatedClass(entityClass);
                }
                catch (ClassNotFoundException ex)
                {
                    throw new RuntimeException(ex);
                }
View Full Code Here

    private void loadHibernateConfiguration() {
      if (hibernateConfig == null) {
        if (config.hasProperty(HIBERNATE_ANNOTATION_CONFIG) &&
            config.getProperty(HIBERNATE_ANNOTATION_CONFIG)
            .toString().equalsIgnoreCase(Boolean.TRUE.toString())) {
          hibernateConfig = new AnnotationConfiguration();
        } else {
          hibernateConfig = new Configuration();
        }
       
        if (config.hasProperty(HIBERNATE_CFG_PATH)) {
View Full Code Here

public class HibernateModule implements Module {
 
  Log log = LogFactory.getLog(HibernateModule.class);
 
  public void configure(Binder binder) {
    AnnotationConfiguration configuration = new AnnotationConfiguration();
   
    if (!configuration.getProperties().contains("hibernate.current_session_context_class")) {
      log.info("Defaulting hibernate.current_session_context_class to managed");
      configuration.setProperty("hibernate.current_session_context_class", "managed");
    }
   
    binder.bind(AnnotationConfiguration.class).toInstance(configuration);
   
    SessionFactory sessionFactory = configuration.configure().buildSessionFactory();   
    binder.bind(SessionFactory.class).toInstance(sessionFactory);

    // Guice/AssistedInject seems to need an explicit binding.
    // this may be able to go away in fiture version of guice
    binder.bind(HibernateUtil.class).to(HibernateUtilImpl.class);
View Full Code Here

    public void doExecute() throws MojoExecutionException
    {
      try {
        Properties props = new Properties();
        props.load(new FileInputStream(hibernateProperties));
        Configuration cfg = new AnnotationConfiguration().configure(hibernateCfgXml);
        cfg.setProperties(props);
            getLog().info("Dropping all database tables.");
      new SchemaExport(cfg).drop(false, true);
      getLog().info("Done,  creating all database tables.");
      new SchemaExport(cfg).create(false, true);
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.