Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jdbc model instrumentation classes

I have maven project to work with database. I connected database correctly. And queries from java code are working, so I can insert new data to base or update, etc. However I need to make method to show data from tables. So I need to create class which 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'm trying to use this class in my programm it doesn't work with 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've no idea how to fix that. I've wasted so much time to google but didn't find anything useful. Help me please. Also I don't need to use cmd or jar. What should I just add to project?

like image 406
Blind Despair Avatar asked Jun 26 '26 05:06

Blind Despair


1 Answers

Fixed. Just needed to use button "package" in Maven projects lifecycle.

like image 55
Blind Despair Avatar answered Jun 28 '26 19:06

Blind Despair



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!