6 Replies Latest reply on Nov 16, 2005 12:01 PM by renkrad

    JBossIDE Hibernate 3.x... Howto

    renkrad

      Hy,
      I'm new to hibernate and JBoss IDE, could anyone post an URL for the JBossIDE Hibernate 3.x.

      Something like a howto. The only howto's i found were related to the hibernate 1.5.
      http://www.hibernate.org/hib_docs/tools/viewlets/createcfgxml_viewlet_swf.html
      and
      http://www.hibernate.org/hib_docs/tools/viewlets/hbmxmlediting_viewlet_swf.html


      Even thought most options are equal there are many feature's that have been changed or some options just have been added. I'm requesting this because i'm having some problems using the Hibernate Console. I'm almost sure that the problems are configuration related.

      I'm using the "JBossIDE-1.5RC1-Bundle-win32".

      Thanx,
      Daniel Campelo

        • 1. Re: JBossIDE Hibernate 3.x... Howto
          maxandersen

          the configuration have not changed since these viewlets. Also check the documentation and especially the new and noteworthy to see changes.

          • 2. Re: JBossIDE Hibernate 3.x... Howto
            renkrad

            Max i heve read them... Both, the demonstration of the Hibernate 1.5 and the what's new for the hibernate 3.x (not the release notes between those 2 versions).

            Anyway, i posted this topic because i'm having some problems opening the Hibernate Configurations view. It throws an exception when i try to open the configuration i defined. The exception referes that the class should have one of the specified anotations, though the class defines the "@javax.persistence.Entity".

            Heres the Stacktrace :

            org.hibernate.AnnotationException: Annotated class should have a @javax.persistence.Entity, @javax.persistence.Embeddable or @javax.persistence.EmbeddedSuperclass annotation: <MY CLASS>
             at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:334)
             at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:256)
             at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:191)
             at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1138)
             at org.hibernate.console.ConsoleConfiguration$2.execute(Unknown Source)
             at org.hibernate.console.execution.DefaultExecutionContext.execute(Unknown Source)
             at org.hibernate.console.ConsoleConfiguration.execute(Unknown Source)
             at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(Unknown Source)
             at org.hibernate.eclipse.console.workbench.ConsoleConfigurationWorkbenchAdapter.getChildren(Unknown Source)
             at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(Unknown Source)
             at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
             at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)


            • 3. Re: JBossIDE Hibernate 3.x... Howto
              maxandersen

              hmm - did you by any chance add ejb3 persistence jars to your console classpath? Don't! ;)

              • 4. Re: JBossIDE Hibernate 3.x... Howto
                renkrad

                 

                "max.andersen@jboss.com" wrote:
                hmm - did you by any chance add ejb3 persistence jars to your console classpath? Don't! ;)


                I didn't, at least to the console, though i added them to tha classpath of the project.

                Created a new project without them defined explicitly in the classpath, using unstead the JBoss lib reference proviided by the eclipse, and it worked. Well it didn't throw any exception, and the only thing that apears on the configurations is the data base schema... The "configuration" and "SessionFactory" tree nothing appears.

                I'm going crazy with this :|

                Is it necessary to create a "persistence.xml" and a "persistence.properties"?

                ------------------
                Here are the steps to use the hibernate :
                - Create a Configuration file
                - Create a console configuration
                - Execute the Artifact Generation (Creates all beans with the anotations)
                - Then i open the Hibernate Configurations View (Here only the database schema appears)

                I'm i doing something wrong?

                Thanx,
                Daniel Campelo


                • 5. Re: JBossIDE Hibernate 3.x... Howto
                  maxandersen

                  no you are doing it right. If nothing comes up in the sessionfactory/configuration then no mappings have been found. Make sure they are listed in hibernate.cfg.xml

                  • 6. Re: JBossIDE Hibernate 3.x... Howto
                    renkrad

                     

                    "max.andersen@jboss.com" wrote:
                    no you are doing it right. If nothing comes up in the sessionfactory/configuration then no mappings have been found. Make sure they are listed in hibernate.cfg.xml


                    Yes there were 2 hibernate.cfg.xml in the project :S

                    It gives an exception again.
                    "org.hibernate.MappingException: duplicate collection role mapping: myPackage.Test1.test2es"


                    Is there any FAQ that i can consult about the eclipse view "hibernate configurations"?

                    This is almost a walkthrought of the configuration problems :|

                    Daniel Campelo