使用 IntelliJ IDEA 调试 ActiveJDBC

Debugging ActiveJDBC with IntelliJ IDEA

我是 ActiveJDBC 的新手。我正在尝试调试 sample 项目。

我要调试的代码是:

public static void main(String[] args) {

    Base.open();

    Person director  = new Person("Stephen Spielberg");
    director.saveIt();

    //[break point here] 
    director.add(new Movie("Saving private Ryan", 1998));
    director.add(new Movie("Jaws", 1982));
    director.getAll(Movie.class).forEach(System.out::println);

    Base.close();
}

代码编译正确并且检测正确执行(我相信)(看看here)。

调试器启动并在定义的断点处暂停。

我正在尝试计算表达式 "Person.count()",我希望结果为 1。

但是我在'Evaluate expression'window中有如下错误:

Method threw 'org.javalite.activejdbc.InitException' exception.

failed to determine Model class name, are you sure models have been instrumented?

看看:https://unsee.cc/nipareto/

您可能在检测后无意中重新编译了模型。如果您检测,然后对模型进行任何更改,然后尝试 运行 您的代码,并且 IDE 将检测到更改并重新编译您的模型,从而消除检测。

确保在 运行 编写代码之前使用仪器。

此外,您提供的link:https://github.com/javalite/activeweb-simple is not corresponding to code. I think you are using this one: https://github.com/javalite/simple-example。如果是这样,请根据 README 在命令行上尝试 运行ning。

在 IDEA 的 ActiveJDBC 中调试模型是我每天做的事情:) 此外,我建议您观看此页面上的视频:http://javalite.io/instrumentation,因为它会逐步引导您使用 IDEA。

2017 年 4 月 10 日更新:

我录制此视频是为了向您展示如何检测和调试 ActiveJDBC 项目:https://www.youtube.com/watch?v=2OeufCH-S4M