14 Replies Latest reply on Jan 23, 2014 6:39 AM by hasnainraza3

    JBoss 7 + Hibernate 4 + JBPM 3

    ohmygod

      I am tring to deploy my project with Hibernate 4 and JBPM 3(3.1.4) in JBoss 7. Now what I am strugging with is JBPM 3 is built by Hibernate 3, which causes many api conflict errors when running into JBPM methods. Is it possible to make JBPM 3 internally built by Hibernate 3 work with Hibernate 4 in my project under JBoss 7 environment?

        • 1. Re: JBoss 7 + Hibernate 4 + JBPM 3
          ctomc

          Hi,

           

          not easy, but you can bundle hibernate 3 with your application, that will make jbpm3 work.

           

          or you can upgrade to jbpm5

           

           

          --

          tomaz

          • 2. Re: JBoss 7 + Hibernate 4 + JBPM 3
            ohmygod

            Thanks, Tomaz. Do you think uprading from JBPM 3 to 5 will need a lot of time because of the complete change from JBPM 3 to 5?

            • 3. Re: JBoss 7 + Hibernate 4 + JBPM 3
              ctomc

              Hi,

               

              it depends what your application does and how big it is.

              But in most cases it is worth bit of effort to do the upgrade.

               

              there are some tools that can help you with migration of your existing processes.

              take a look at:

              https://community.jboss.org/wiki/JBPM5MigrationToolProject

              http://kverlaen.blogspot.com/2011/01/migrating-to-jbpm5.html

              http://www.slideshare.net/eschabell/jbpm-migration-tool-no-one-is-left-behind

               

              --

              tomaz

              • 4. Re: JBoss 7 + Hibernate 4 + JBPM 3
                szus

                I guess it does not matter any more, nevertheless it is possible to rebuild JBPM3 with dependency to Hibernate4.

                I tried with jbpm 3.2.2 and hibernate 4.2.6 - seems to work ok, I ended with just few classes reworked.

                This is not strictly solution as you required it, but definitely easier than jbpm migration/hibernate3 encapsulation etc.

                • 5. Re: JBoss 7 + Hibernate 4 + JBPM 3
                  medrambler

                  Hi Szymon Stryczek,

                  i want to make same for JBPM4.4 to rebuild it with Hibernate4, you think also possible

                   

                  being that you already do for JBPM3

                  could you give me ideas on what to change so that it runs

                   

                  i know that JBPM4 is a complet rewrite for JBPM but your approach will be very useful for me since the target hibernate version is the same

                   

                  thank you in advance

                  • 6. Re: JBoss 7 + Hibernate 4 + JBPM 3
                    szus

                    Hi,

                     

                    I've chosen straight forward solution, changed hibernate version in pom.xml and worked out every compilation error.

                    I didn't look in details how jbpm works out their things.

                    My solution can be divided in to two types:

                    1. Class relocation - i.e. hibernate types LONG, INT... - quite tricky to resolve (funny fact - easier by "TotalCommander search in archive" than hibernate forums )

                    2. Method deprecation - to be exact it can be worked down to just one case -> session.getConnection().

                    I've got no easy or clean workaround for that but hb4 has "doWork API", so I made this:

                     

                    private class GetConnectionWork implements Work {

                         

                            private Connection connection = null;

                            /* (non-Javadoc)

                             * @see org.hibernate.jdbc.Work#execute(java.sql.Connection)

                             */

                            @Override

                            public void execute(Connection arg0) throws SQLException {

                                this.connection = arg0;

                            }

                            /**

                             * @return the connection

                             */

                            public Connection getConnection() {

                                return connection;

                            }

                         

                        }

                    then:

                    GetConnectionWork work = new GetConnectionWork();

                    session.doWork(work);

                    connection = work.getConnection();

                     

                     

                    And that's it.

                    • 7. Re: JBoss 7 + Hibernate 4 + JBPM 3
                      medrambler


                      Hi,

                      Thank you for your response, my question now is where you've modifay the source code in the jBpm3 side or hb4 src side ?

                      according to the example you have share me that same the modifay it was in hb4 side ?

                      for my case it will be preferable that the eventual modification been in the jBmp4 not in the hb4 side?

                      do u think it also an possiblity to adapting jbmp4 to run with hb4 ?

                      thank you in advance Szymon

                      • 8. Re: JBoss 7 + Hibernate 4 + JBPM 3
                        szus

                        My suggestion are strictly for jbpm changes.

                        There is no "reasonable reason" to change still maintained hb4 instead of not maintained anymore - old jbpm.

                        Old JBPM will not change anymore, hb4 surely will.

                        • 9. Re: JBoss 7 + Hibernate 4 + JBPM 3
                          medrambler

                          thank you that was i like to have, changing in jbpm and keeping an antact official release for hb4

                          all try to do with the same manner like you

                          regards

                          • 10. Re: JBoss 7 + Hibernate 4 + JBPM 3
                            neville.sequeira

                            Thanks szusWould it be possible for you to share your code changes to jbpm3?

                            • 11. Re: JBoss 7 + Hibernate 4 + JBPM 3
                              szus

                              I guess I shouldn't ... http://pastebin.com/2aqpB8Si

                              • 12. Re: JBoss 7 + Hibernate 4 + JBPM 3
                                smarlow

                                I like Hibernate 4.x and moving your applications to it but also wanted to mention these instructions that might help you get Hibernate 3.5.x or 3.6.x going as well.  Notes for creating a Hibernate 3.x global module are here (corrections/updates are welcome).  Just don't try to use Hibernate version < 3.5.x unless you have an EAP subscription so that you can get the latest Hibernate 3.3.x.

                                • 13. Re: JBoss 7 + Hibernate 4 + JBPM 3
                                  neville.sequeira

                                  Thanks for sharing the code szus

                                  • 14. Re: JBoss 7 + Hibernate 4 + JBPM 3
                                    hasnainraza3

                                    I am trying to deploy JBPM 3.3.1 in jboss 7.1.1 with hibernate 4.Should i modify JBPM hibernate version.Please provide me some examples to deploy JBPM 3.3.1 in Jboss 7