Incorrect persistence.xml used for main store

Hi Team,

Jmix composite project run Junit test failed after adding another add-on. The error msg is:

java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: 
    Exception Description: Problem compiling [select e from testa_NewEntity e]. 
    [14, 29] The abstract schema type 'testa_NewEntity' is unknown.

Please find attached sample project with following setups:osmain.zip (415.0 KB)

  1. new composite project.
  2. add an add-on.
  3. in the add-on, create an entity and add changelog for it.
  4. Run the Junit test case in the add-on, it will success.
  5. add quartz starter to the add-on
  6. Run the Junit test case again, it will fail with above error msg.

I suspect the cause lays in the following line in the log:

i.j.d.i.JmixBaseEntityManagerFactoryBean : Using persistence.xml at io/jmix/quartz/persistence.xml for 'main' store

It uses quartz’s persistence.xml, no wonder can’t find definition of the new entity.

The configuration of persistence.xml should be an array of all the files located in all modules, rather than a single file which it first met.

Please help check. Thanks!

Hi Bryan,

You should add dependency on Quartz add-on to @JmixModule annotation of your test configuration, like this:

@Configuration
// ...
@JmixModule(dependsOn = {..., QuartzConfiguration.class})
public class MyTestConfiguration {

Regards,
Konstantin

1 Like

Thanks Konstantin! I did the test just now and it passed.