6 Replies Latest reply on Jul 17, 2009 10:07 AM by Simone Mori

    Help with har and hbm files

    Simone Mori Newbie

      I've a big problem.
      I've build an har file and when I deploy it on my default installation it configures correctly the SessionFactory, but the hbm contained in the har are not mapped (not scanned).
      Please help. it's 3 days I'm stuck with this.
      Thanks in advance to everybody.

        • 1. Re: Help with har and hbm files
          Ales Justin Master

          1) You need to provide better info
          * re-read your post and tell me from which info I can deduct *anything*

          2) You need to do your homework
          * how to ask for help: http://www.jboss.org/community/wiki/JBossHelp
          * search this forum for similar questions

          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=157973
          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=155832

          • 2. Re: Help with har and hbm files
            Simone Mori Newbie

            I've built an HAR file with the following contents

            \
             SCN-hibernate.xml
             .project
             .class
             META-INF
             MANIFEST.MF
             hibernate-service.xml
             it\siav\scn\hibernate\entity
             Sga.hbm.xml
             Sga.class
            


            File SCN-hibernate.xml:
             [hibernate-configuration xmlns="urn:jboss:hibernate-deployer:1.0"]
             [session-factory name="java:/hibernate/SCN/SF" bean="SCNHibernate.jar:app=SCN"]
             [property name="datasourceName"]java:/jdbc/SCN[/property]
             [property name="showSqlEnabled"]true[/property]
             [property name="scanForMappingsEnabled"]true[/property]
             [property name="harUrl" /]
             [depends]jboss:service=Naming[/depends]
             [depends]jboss:service=TransactionManager[/depends]
             [/session-factory]
             [/hibernate-configuration]
            


            When I deploy the HAR file to the deploy directory, I see this on the
            console:

            2009-07-17 10:51:39,712 INFO [org.jboss.hibernate.deployers.HibernateDeployer] (HDScanner) Created Hibernate bean: AbstractBeanMetaData@6cf504{name=SCNHibernate.jar:app=SCN bean=org.jboss.hibernate.jmx.Hibernate properties=[harUrl, sessionFactoryName, scanForMappingsEnabled, datasourceName, showSqlEnabled] constructor=AbstractConstructorMetaData@14a123f{parameters=[org.jboss.virtual.VirtualFile]} autowireCandidate=true depends=[jboss:service=Naming, jboss:service=TransactionManager]}
            2009-07-17 10:51:39,805 DEBUG [org.jboss.hibernate.jmx.Hibernate] (HDScanner) Hibernate MBean starting; org.jboss.hibernate.jmx.Hibernate@14b6b5d [BeanName=SCNHibernate.jar:app=SCN, JNDI=java:/hibernate/SCN/SF]
            2009-07-17 10:51:39,805 DEBUG [org.jboss.hibernate.jmx.Hibernate] (HDScanner) Building SessionFactory; org.jboss.hibernate.jmx.Hibernate@14b6b5d [BeanName=SCNHibernate.jar:app=SCN, JNDI=java:/hibernate/SCN/SF]
            2009-07-17 10:51:39,852 INFO [org.hibernate.cfg.Environment] (HDScanner) Hibernate 3.3.1.GA
            2009-07-17 10:51:39,852 INFO [org.hibernate.cfg.Environment] (HDScanner) hibernate.properties not found
            2009-07-17 10:51:39,852 INFO [org.hibernate.cfg.Environment] (HDScanner) Bytecode provider name : javassist
            2009-07-17 10:51:39,868 INFO [org.hibernate.cfg.Environment] (HDScanner) using JDK 1.4 java.sql.Timestamp handling
            2009-07-17 10:51:39,930 DEBUG [org.jboss.hibernate.jmx.Hibernate] (HDScanner) Using JDBC batch size : null
            2009-07-17 10:51:39,930 DEBUG [org.hibernate.cfg.Configuration] (HDScanner) Preparing to build session factory with filters : {}
            2009-07-17 10:51:39,930 DEBUG [org.hibernate.cfg.Configuration] (HDScanner) processing extends queue
            2009-07-17 10:51:39,930 DEBUG [org.hibernate.cfg.Configuration] (HDScanner) processing collection mappings
            2009-07-17 10:51:39,930 DEBUG [org.hibernate.cfg.Configuration] (HDScanner) processing native query and ResultSetMapping mappings
            2009-07-17 10:51:39,930 DEBUG [org.hibernate.cfg.Configuration] (HDScanner) processing association property references
            2009-07-17 10:51:39,930 DEBUG [org.hibernate.cfg.Configuration] (HDScanner) processing foreign key constraints
            2009-07-17 10:51:39,946 INFO [org.hibernate.util.NamingHelper] (HDScanner) JNDI InitialContext properties:{}
            2009-07-17 10:51:39,946 INFO [org.hibernate.connection.DatasourceConnectionProvider] (HDScanner) Using datasource: java:/jdbc/SCN
            2009-07-17 10:51:40,821 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) RDBMS: Microsoft SQL Server, version: 9.00.3042
            2009-07-17 10:51:40,821 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) JDBC driver: Microsoft SQL Server JDBC Driver 2.0, version: 2.0.1803.100
            2009-07-17 10:51:40,883 INFO [org.hibernate.dialect.Dialect] (HDScanner) Using dialect: org.hibernate.dialect.SQLServerDialect
            2009-07-17 10:51:40,946 INFO [org.hibernate.transaction.TransactionFactoryFactory] (HDScanner) Transaction strategy: org.hibernate.transaction.JTATransactionFactory
            2009-07-17 10:51:40,946 INFO [org.hibernate.util.NamingHelper] (HDScanner) JNDI InitialContext properties:{}
            2009-07-17 10:51:40,946 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] (HDScanner) instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
            2009-07-17 10:51:40,946 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] (HDScanner) instantiated TransactionManagerLookup
            2009-07-17 10:51:40,946 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] (HDScanner) instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
            2009-07-17 10:51:40,946 INFO [org.hibernate.transaction.TransactionManagerLookupFactory] (HDScanner) instantiated TransactionManagerLookup
            2009-07-17 10:51:40,946 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Automatic flush during beforeCompletion(): enabled
            2009-07-17 10:51:40,946 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Automatic session close at end of transaction: enabled
            2009-07-17 10:51:40,946 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Scrollable result sets: enabled
            2009-07-17 10:51:40,946 DEBUG [org.hibernate.cfg.SettingsFactory] (HDScanner) Wrap result sets: disabled
            2009-07-17 10:51:40,946 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) JDBC3 getGeneratedKeys(): enabled
            2009-07-17 10:51:40,946 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Connection release mode: after_statement
            2009-07-17 10:51:40,961 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Default batch fetch size: 1
            2009-07-17 10:51:40,961 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Generate SQL with comments: disabled
            2009-07-17 10:51:40,961 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Order SQL updates by primary key: disabled
            2009-07-17 10:51:40,961 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Order SQL inserts for batching: disabled
            2009-07-17 10:51:40,961 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
            2009-07-17 10:51:40,977 INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] (HDScanner) Using ASTQueryTranslatorFactory
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Query language substitutions: {}
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) JPA-QL strict compliance: disabled
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Second-level cache: enabled
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Query cache: disabled
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
            2009-07-17 10:51:40,977 INFO [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge] (HDScanner) Cache provider: org.hibernate.cache.HashtableCacheProvider
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Optimize cache for minimal puts: disabled
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Structured second-level cache entries: disabled
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Echoing all SQL to stdout
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Statistics: disabled
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Deleted entity synthetic identifier rollback: disabled
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Default entity-mode: pojo
            2009-07-17 10:51:40,977 INFO [org.hibernate.cfg.SettingsFactory] (HDScanner) Named query checking : enabled
            2009-07-17 10:51:41,071 INFO [org.hibernate.impl.SessionFactoryImpl] (HDScanner) building session factory
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryImpl] (HDScanner) Session factory constructed with filter configurations : {}
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryImpl] (HDScanner) instantiating session factory with properties: {hibernate.transaction.flush_before_completion=true, hibernate.transaction.auto_close_session=true, hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider, hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup, hibernate.connection.agressive_release=true, hibernate.connection.datasource=java:/jdbc/SCN, hibernate.show_sql=true, hibernate.connection.release_mode=after_statement, hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory}
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] (HDScanner) initializing class SessionFactoryObjectFactory
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryObjectFactory] (HDScanner) registered: 402886862287e8dd012287e8dd9e0000 (unnamed)
            2009-07-17 10:51:41,086 INFO [org.hibernate.impl.SessionFactoryObjectFactory] (HDScanner) Not binding factory to JNDI, no JNDI name configured
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryImpl] (HDScanner) instantiated session factory
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryImpl] (HDScanner) obtaining JTA TransactionManager
            2009-07-17 10:51:41,086 INFO [org.hibernate.util.NamingHelper] (HDScanner) JNDI InitialContext properties:{}
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryImpl] (HDScanner) Checking 0 named HQL queries
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryImpl] (HDScanner) Checking 0 named SQL queries
            2009-07-17 10:51:41,086 DEBUG [org.hibernate.impl.SessionFactoryImpl] (HDScanner) Returning a Reference to the SessionFactory
            2009-07-17 10:51:41,086 INFO [org.jboss.hibernate.jmx.Hibernate] (HDScanner) SessionFactory successfully built and bound into JNDI [java:/hibernate/SCN/SF]



            Please Help....

            • 3. Re: Help with har and hbm files
              Ales Justin Master

              What about if you remove

              <property name="harUrl" />
              

              from -hibernate.xml?

              • 4. Re: Help with har and hbm files
                Ales Justin Master

                Hmmm, I doubt it's that, since root should "win" over harUrl.

                Could you debug this class (unfortunately it doesn't have any proper logging ...)
                * http://anonsvn.jboss.org/repos/jbossas/trunk/hibernate-int/src/main/org/jboss/hibernate/jmx/HibernateMappingVisitor.java

                • 5. Re: Help with har and hbm files
                  Ales Justin Master

                  Ah, I see what it is. ;-)

                  Your -hibernate.xml file should be in META-INF,
                  otherwise it is treated as a sub-deployment, hence its root is the file itself.

                  Simply move the SCN-hibernate.xml into jar's META-INF and you'll be fine.

                  • 6. Re: Help with har and hbm files
                    Simone Mori Newbie

                    Thanks a lot.
                    IT WORKS!