Package org.hibernate.cfg

Examples of org.hibernate.cfg.Configuration.addAnnotatedClass()


   
    private static Configuration toNativeHibernateConfiguration(HibernateConfiguration hibernateCfg)
    {
        Configuration cfg = new Configuration();
        for(Class<?> domainClass : hibernateCfg.getDomainClasses())
            cfg.addAnnotatedClass(domainClass);
       
        cfg.setProperty("hibernate.connection.username", hibernateCfg.getDbUser());
        cfg.setProperty("hibernate.connection.password", hibernateCfg.getDbPass());
        cfg.setProperty("hibernate.connection.url", hibernateCfg.getDbConnectionUrl());
        cfg.setProperty("hibernate.connection.driver_class", hibernateCfg.getDbDriverClass().getCanonicalName());
View Full Code Here


    @Override
    public void init() {
       
        Configuration cfg = new Configuration();
        for (Class cls : entityClasses) {
            cfg.addAnnotatedClass(cls);
        }

        //set the hibernate properties
        for (Object key : properties.keySet()) {
            String keyStr = key.toString();
View Full Code Here

  private static SessionFactory factory;

  @BeforeClass
  public static void geraBanco(){
    Configuration cfg = new Configuration();
    cfg.addAnnotatedClass(PessoaFisica.class);
    ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(cfg.getProperties()).build();       
        factory = cfg.buildSessionFactory(serviceRegistry);
  }
 
  @Test
View Full Code Here

    // todo : need to have this use the metamodel codebase eventually...

    for ( JaxbHibernateConfiguration.JaxbSessionFactory.JaxbMapping jaxbMapping : cfgXmlNamedMappings ) {
      if ( jaxbMapping.getClazz() != null ) {
        cfg.addAnnotatedClass(
            serviceRegistry.getService( ClassLoaderService.class ).classForName( jaxbMapping.getClazz() )
        );
      }
      else if ( jaxbMapping.getResource() != null ) {
        cfg.addResource( jaxbMapping.getResource() );
View Full Code Here

    }

    List<Class> loadedAnnotatedClasses = (List<Class>) configurationValues.remove( AvailableSettings.LOADED_CLASSES );
    if ( loadedAnnotatedClasses != null ) {
      for ( Class cls : loadedAnnotatedClasses ) {
        cfg.addAnnotatedClass( cls );
      }
    }

    for ( String className : metadataSources.getAnnotatedMappingClassNames() ) {
      cfg.addAnnotatedClass( serviceRegistry.getService( ClassLoaderService.class ).classForName( className ) );
View Full Code Here

        cfg.addAnnotatedClass( cls );
      }
    }

    for ( String className : metadataSources.getAnnotatedMappingClassNames() ) {
      cfg.addAnnotatedClass( serviceRegistry.getService( ClassLoaderService.class ).classForName( className ) );
    }

    for ( MetadataSources.ConverterDescriptor converterDescriptor : metadataSources.getConverterDescriptors() ) {
      final Class<? extends AttributeConverter> converterClass;
      try {
View Full Code Here

   
    private static Configuration toNativeHibernateConfiguration(HibernateConfiguration hibernateCfg)
    {
        Configuration cfg = new Configuration();
        for(Class<?> domainClass : hibernateCfg.getDomainClasses())
            cfg.addAnnotatedClass(domainClass);
       
        cfg.setProperty("hibernate.connection.username", hibernateCfg.getDbUser());
        cfg.setProperty("hibernate.connection.password", hibernateCfg.getDbPass());
        cfg.setProperty("hibernate.connection.url", hibernateCfg.getDbConnectionUrl());
        cfg.setProperty("hibernate.connection.driver_class", hibernateCfg.getDbDriverClass().getCanonicalName());
View Full Code Here

        String dataSourceName = checkForDataSource();
        UserTransaction ut = dataSourceName != null ? findUserTransaction() : null; //do not even try...

        Configuration configuration = new Configuration().configure();
    for (Class cls : annotatedClasses.values()) {
      configuration.addAnnotatedClass(cls);
    }

    for (String name : hibernateResources.keySet()) {
      byte[] b = hibernateResources.get(name);
      if (b != null && b.length > 0) {
View Full Code Here

    // todo : need to have this use the metamodel codebase eventually...

    for ( JaxbHibernateConfiguration.JaxbSessionFactory.JaxbMapping jaxbMapping : cfgXmlNamedMappings ) {
      if ( jaxbMapping.getClazz() != null ) {
        cfg.addAnnotatedClass(
            serviceRegistry.getService( ClassLoaderService.class ).classForName( jaxbMapping.getClazz() )
        );
      }
      else if ( jaxbMapping.getResource() != null ) {
        cfg.addResource( jaxbMapping.getResource() );
View Full Code Here

      for ( Class cls : loadedAnnotatedClasses ) {
        if ( AttributeConverter.class.isAssignableFrom( cls ) ) {
          cfg.addAttributeConverter( (Class<? extends AttributeConverter>) cls );
        }
        else {
          cfg.addAnnotatedClass( cls );
        }
      }
    }

    for ( String className : metadataSources.getAnnotatedMappingClassNames() ) {
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.