Hide Forgot
Description of problem: When I want to use "org.jbpm.persistence.jpa" persistence unit (PU) from persistence.xml in jbpm-test module, I receive "HibernateException: Missing table: Attachment". That's because PU doesn't specify hibernate.hbm2ddl.auto and neither it's specified in JbpmJUnitBaseTestCase. Sure I can use my own PU but the default PU is then pointless there. Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. Start a test (can be empty) inheriting from JbpmJUnitBaseTestCase 2. The test should call super constructor super(boolean setupDataSource = true, boolean sessionPersistence = true) 3. During the call of method JbpmJUnitBaseTestCase.setUp(), see the exception about the missing table Actual results: Expected results: Additional info:
Lowering severity as this is in the test module and there's an easy workaround.
Well the hibernate.hbm2ddl.auto property is set but to "validate" which won't create the tables. So it might be enough to change it to "create-drop" or make it possible to set it in JbpmJUnitBaseTestCase.
Ivo, this doesn't seem to be the case in jbpm 6.0.x branch in the community: https://github.com/droolsjbpm/jbpm/blob/6.0.x/jbpm-test/src/main/resources/META-INF/persistence.xml#L57 Do you know why there is a difference, and if so, why we shouldn't revert it?
Hi Ryan, thank you for the explanation, I don't understand much but it's important to know it's not made by an accident. Then I suggest to change JbpmJUnitBaseTestCase a little. On the line https://github.com/droolsjbpm/jbpm/blob/master/jbpm-test/src/main/java/org/jbpm/test/JbpmJUnitBaseTestCase.java#L184 where you create the EntityManagerFactory (emf = Persistence.createEntityManagerFactory(persistenceUnitName);), I would add a map as the optional parameter, containing the hibernate.hbm2ddl.auto property to override the "validate" value with "update", so only if JbpmJUnitBaseTestCase were used with persistence, the tables would be created.
Ryan, the persistence.xml is in the jbpm-test module, it should only be included for JUnit tests (where you can easily instantiate a test environment, using H2 and bitronix). It seems unlikely FSW needs this jar (if they are using it, it might be worth checking why, because I believe it should probably be excluded). So I would recommend to change the hibernate.hbm2dll.auto property back to update, as I believe this should not impact FSW. FSW should define their own persistence.xml (similar to how our workbench for example defines one - https://github.com/droolsjbpm/kie-wb-distributions/blob/master/kie-wb/kie-wb-webapp/src/main/resources/META-INF/persistence.xml), and there they can set their own properties.
Setting as blocker as this needs to be resolved, otherwise the jbpm-test jar will be useless.
Ok, Kris, I can recover the proprety to update now. FSW don't need this jar. The reason it patched the jbpm-test.jar is to make hibernateMavenPlugin working which is design to generate DB schemal from persistence.xml. If I understand correctly, the plugin will scan all persistence.xml in jbpm and generating the db schema. I would discuss with my colleage about if FSW should use their own persistence.xml or not. But for now, because decision has been made that FSW will freeze on droolsjbpm version (ER5), until GA. So we can fix this issue as you suggested without any impact to FSW. (In reply to Kris Verlaenen from comment #7) > Ryan, the persistence.xml is in the jbpm-test module, it should only be > included for JUnit tests (where you can easily instantiate a test > environment, using H2 and bitronix). > > It seems unlikely FSW needs this jar (if they are using it, it might be > worth checking why, because I believe it should probably be excluded). So I > would recommend to change the hibernate.hbm2dll.auto property back to > update, as I believe this should not impact FSW. > > FSW should define their own persistence.xml (similar to how our workbench > for example defines one - > https://github.com/droolsjbpm/kie-wb-distributions/blob/master/kie-wb/kie-wb- > webapp/src/main/resources/META-INF/persistence.xml), and there they can set > their own properties.
Verified in BPMS 6.0.0.ER7