Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
jBPM: No datasource on schema-creation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jBPM: No datasource on schema-creation

    Just tried to get started with spring-jbpm (from cvs), jBPM 3.0.2 and hibernate 3.1.1.

    I had problems on spring configuration of jBPM in conjunction with JbpmSchema#createSchema invocation. I always got a "No local data source" exception.

    Now I tracked down the problem:
    the createSchema() method tries to get a connection via org.hibernate.connection.ConnectionProviderFactory. This one instantiates a new org.springframework.orm.hibernate3.LocalDataSource ConnectionProvider instance. This instance tries to resolve the data source via LocalSessionFactoryBean.getConfigTimeDataSource().
    The point is, that a DataSource configured to org.springframework.orm.hibernate3.LocalSessionFac toryBean could not be resolved for that new instance, because the configTimeDataSource property is not available anymore (reset after initialization).

    Now, in order to create the jBpm schema, one has to supply database parameters in the hibernate properties and omit the data source.
    Note, that accessing a created schema works with a spring configured data source.

    Maybe someone has a solution for this issue?

    Regards,
    Andreas

  • #2
    Please raise an issue - I *might* be able to look at this issue at some point in the future. IIRC, the LocalSessionFactoryBean had a similar problem and the fix was pretty trivial (keep the datasource around for schema export) - I'm sure it can apply to your case though.
    Last edited by Costin Leau; Jan 18th, 2006, 04:07 PM.

    Comment


    • #3
      Done

      I created the issue for Spring modules, since the problem occurred there. Though I think changes in ORM classes might also be required.

      Andreas

      Comment


      • #4
        Thanks. I'll try to reproduce it. I'm not up-to-date with the status of jBPM especially since it was moved on the sf.net CVS. I'll try to contact Rob and see what's the situation.
        I'll keep you update but again, it might take a while.

        Comment


        • #5
          Just in case you are not watching the JIRA, I have created a very simple test that confirms the bug and indeed the fault lies in the LocalSessionFactoryBean. You can see the JIRA issue for more details. Thanks for reporting.

          Comment


          • #6
            I tracked the issue. As it seems, we have to wait for jBPM 3.1 which hopefully handles this case more sensible.

            Anyway, thanks for your help.
            Andreas

            Comment


            • #7
              I have some ideas on a possible workaround for even with jbpm 3.0.x. One would be to extend the jbpmSchema class so that execute method (which calls the static Hibernate ConnectionProvider) would work better. I haven't tested yet but I hope I will in the very near future.

              Comment


              • #8
                One solution for this problem (which already existed inside the tests) is to set SchemaUpdate to true on HB localSessionFactory. This will force the HBSessionFactoryBean to create the mapping before even the jBPM will be initilialized.
                However, you still have the problem with JbpmSchema - when doing dropping for clean/create/drop. In these situation you can get the LocalSessionFactoryBean and use create/drop/updateDatabaseSchema.
                Note that this will work at any (not just during the afterPropertiesSet()). I have imlemented the same mechanism as the one used in Hibernate (add a special ConnectionProvider) but that just duplicates code and it's available just during start-up (afterPropertiesSet).

                Comment


                • #9
                  The SchemaUpdate-flag I didn't want to use. I built a test prototype and wanted to be able to perform cleaning in between.
                  Ok, a manual approach would be possible in any case, so that could be a fallback (even with code duplication).

                  I think the approach to override JbpmSchema seems to be a good idea.

                  Regards,
                  Andreas

                  Comment


                  • #10
                    Overriding the jbpmSchema is a really ugly hack - I can't extend the problematic method (createConnection) since it's private so I basically have to duplicate code which is not just hard to maintain but may actually create an license issue and will fall under the LGPL license which is not compatible with Apache/BSD.
                    I'm not happy with the outcome and that's why I recommend using the methods on LocalSessionFactory since they offer IMO a clean solution that exists already and moreover, that is available during the whole lifetime of the HB/jBPM factoryBeans.

                    Comment


                    • #11
                      Originally posted by costin
                      Overriding the jbpmSchema is a really ugly hack - I can't extend the problematic method (createConnection) since it's private so I basically have to duplicate code which is not just hard to maintain but may actually create an license issue and will fall under the LGPL license which is not compatible with Apache/BSD.
                      I didn't examine the sources that closely. But if it is indeed as you said, you're right. A simple subclassing with a few extensions would be fine, but reimplementing half of the class is indeed ugly.

                      I'm not happy with the outcome and that's why I recommend using the methods on LocalSessionFactory since they offer IMO a clean solution that exists already and moreover, that is available during the whole lifetime of the HB/jBPM factoryBeans.
                      Ok, so that should be the way to proceed then.

                      Thanks again,
                      Andreas

                      Comment

                      Working...
                      X