Search code examples
activejdbc

How do I instrument tables for a subproject(activejdbc)? IE, one of my maven dependencies uses activejdbc


I'm 80% sure the problem I'm having is because of instrumentation.

So I have a project(A), that uses project(B) as its maven dependency.

Project B uses activejdbc.

Running mvn process-classes on project A does not appear to instrument the tables for Project B.

It gives me the following error. I can verify that the constructor is indeed there, despite what it says.

Exception in thread "main" org.javalite.activejdbc.InitException: Model 'com.xxx.xx.Tables$Currency' must provide a default constructor. Table:
    at org.javalite.activejdbc.Model.create(Model.java:2143)
    at org.javalite.activejdbc.Model.createIt(Model.java:2181)
    at com.xxx.xx.Tables$Currency.createIt(Tables.java:2178)
Caused by: java.lang.NullPointerException
    at org.javalite.activejdbc.Model.setRaw(Model.java:234)
    at org.javalite.activejdbc.Model.set(Model.java:224)
    at org.javalite.activejdbc.ModelDelegate.setNamesAndValues(ModelDelegate.java:52)
    at org.javalite.activejdbc.Model.create(Model.java:2137)
    ... 8 more

Solution

  • You need to use parent/child Maven setup. Please, see a full answer here: https://github.com/javalite/activejdbc/issues/392