6 Replies Latest reply on Feb 11, 2013 12:59 PM by dbuttery

    Using Hibernate with JBoss 5.1

    dbuttery

      Ok...   I've been perusing the web and the forums.  I've seen lots of 'examples' and 'suggestions' ...

       

      Can someone provide a true example of how to setup a Hibernate configuration that actually works with 5.1 (ESB)?

       

      I have been working with using a '-hibernate.xml' config file and am struggling with DOCTYPEs and xmlns declarations (per other examples).  None of it works.

       

      I did stumble upon one combo that sort of worked except that it then complained about my <mapping ...> declarations.

       

      So...  Is there any viable example of configuration xml out there?

       

      Yours in frustration,

      -Dennis

        • 1. Re: Using Hibernate with JBoss 5.1
          tcunning

          Dennis,

           

          What exactly are you trying to do?     Are you using the Hibernate Gateway?      The helloworld_hibernate_action quickstart has a hibernate.cfg.xml that I believe works.

          • 2. Re: Using Hibernate with JBoss 5.1
            dbuttery

            Hi Tom.

             

                Not looking to use the gateway...   I'm looking to be able to perform straight-forward CRUD operations on my Oracle database.

             

                 Will the quickstart hibernate.cfg.xml suffice to get that going?

             

            -Dennis

            • 3. Re: Using Hibernate with JBoss 5.1
              tcunning

              Not really.      The hibernate gateway is intended to work around the detection of hibernate actions (someone inserting a row, changing a row, deletion, etc).

               

              Can you use JPA?    There's plenty of examples of hibernate-based JPA in the server (persistence.xml / jbpm.esb, juddi, etc).

              • 4. Re: Using Hibernate with JBoss 5.1
                dbuttery

                Not too familiar with JPA.    Any handy tutorial/example links lying around? 

                 

                I am looking to get this working from within an ESB.   I had been trying to get a xxx-hibernate.xml  config working but was slamming into the DOCTYPE & namespace incompatibilities ...

                 

                Would it be better to go with a hibernate.cfg.xml approach and define my mappings in code? (i.e.  add them directly to the Configuration object?)

                 

                -Dennis

                • 5. Re: Using Hibernate with JBoss 5.1
                  tcunning

                  Dennis,

                   

                  I don't have any good examples of hibernate usage inside of ESB, but they shouldn't be that different from what you'd do inside of a .WAR.      Have you gone through the examples in the hibernate project?    Maybe there's something good there?

                   

                  http://www.hibernate.org/

                   

                  Sorry for the lack of help here - this seems more of a straight hibernate issue than an ESB one.       The ESB has simple gateways for grabbing data from rows in a database table (helloworld_sql_action for example), and you can use camel_jpa for grabbing objects as well.      If you're trying to CRUD operations within your actions though, that seems just like a hibernate configuration issue you are dealing with.

                  • 6. Re: Using Hibernate with JBoss 5.1
                    dbuttery

                    Yep.   It turned out to be a simple fix.  I went with a straight-forward hibernate.cfg.xml on the classpath ( as opposed to a xxx-hibernate.xml ESB resource) and all is well.