Instrument Classes Model Jdbc

I have a maven project to work with a database. I have connected the database correctly. And queries from java code work, so I can insert new data into the database or update etc. However, I need to make a method to display data from tables. So I need to create a class that extends Model from activejdbc.Model. This class:

import org.javalite.activejdbc.Model;
import org.javalite.activejdbc.annotations.Table;

@Table("emp")
public class emp extends Model{
    static{
        validatePresenceOf("empno", "ename");
    }

}

      

Whenever I try to use this class in my program, it fails with an exception:

Exception in thread "main" org.javalite.activejdbc.InitException: failed to determine Model class name, are you sure models have been instrumented?
    at org.javalite.activejdbc.Model.getDaClass(Model.java:2801)
    at org.javalite.activejdbc.Model.findAll(Model.java:2386)
    at Program.main(Program.java:14)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

      

I don't know how to fix this. I've spent so much time on google but didn't find anything useful. Help me please. Also I don't need to use cmd or jar. What should I add to the project?

+3


source to share


1 answer


Fixed. You just need to use the "package" button in your Maven project lifecycle.



+3


source







All Articles