3

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?

Blind Despair
  • 3,190
  • 2
  • 20
  • 31
  • Second result on Google when searching for the error message returns [this](http://stackoverflow.com/questions/3780362/cant-get-activejdbc-working). Don't say that "you didn't find anything useful" when you mean that "nobody gave me an easy 1-line solution". If you can't find useful things on Google, how do you expect to be able to program? – Kayaman Apr 29 '15 at 07:54
  • There is no even examples with comments, just random code, that I should understand. Seriously? – Blind Despair Apr 29 '15 at 07:58
  • I read this http://javalite.io/instrumentation and I've seen examples from https://github.com/javalite/simple-example but when I added it to my pom.xml file, nothing changed – Blind Despair Apr 29 '15 at 08:03
  • You're using an ORM and Maven and this is not a homework question, so yes I really expected that you'd understand code. I'd recommend running Maven on verbose to see whether it's doing anything related to the plugin. – Kayaman Apr 29 '15 at 08:15
  • I'm here to help people, but when people say "I found nothing on Google, plz give me the codes" it's not exactly rewarding. It's your problem, so you're the one who should be googling and doing the work to solve it (besides, these days you practically have all the answers written out for you, thanks to sites like StackOverflow). – Kayaman Apr 29 '15 at 08:18
  • If I would solve my problem just using googl I wouldn't ask you here. But this case is too difficalt for me, because I newbe to programming. However thx for your angry comments. It helps a lot. And I didn't ask for complete code, I'm just asking people who can explain me which file need to create in project or how exacly working these maven plugin. – Blind Despair Apr 29 '15 at 08:36
  • I'm not angry, just disappointed. You didn't ask for complete code, but you asked for complete instructions. It's basically the same thing. I suggest you forget your current project and try something easier first. – Kayaman Apr 29 '15 at 08:39

1 Answers1

3

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

Blind Despair
  • 3,190
  • 2
  • 20
  • 31