[英]ActiveJDBC failed to determine Model class name while findFirst but not while insert
While debugging in eclipse below spring boot application is working fine inserting a record in the table but is not while doing findFirst, giving me: failed to determine Model class name, are you sure models have been instrumented?
While debugging in eclipse below spring boot application is working fine inserting a record in the table but is not while doing findFirst, giving me:
failed to determine Model class name, are you sure models have been instrumented?
Gradle: Gradle:
plugins {
(...)
id 'java'
id "de.schablinski.activejdbc-gradle-plugin" version "1.2" apply false
}
(...)
dependencies {
implementation group: 'org.javalite', name: 'activejdbc', version: '1.4.11'
implementation group: 'org.javalite', name: 'activejdbc-instrumentation', version: '1.4.11'
(...)
}
/** Task: Instrument ActiveJdbc models **/
task activeJdbcInstrumentation() {
apply plugin: 'de.schablinski.activejdbc-gradle-plugin'
}
build.dependsOn(activeJdbcInstrumentation)
Java Java
Base.open(dataSource);
try {
TestConJavaLite model = new TestConJavaLite();
model.setString("ID", UUID.randomUUID());
model.setString("Column1", UUID.randomUUID());
model.setString("Column2", UUID.randomUUID());
model.setString("Column3", UUID.randomUUID());
model.setString("Column4", UUID.randomUUID());
model.setString("Column5", UUID.randomUUID());
model.setString("Column5", UUID.randomUUID());
model.setString("Column6", UUID.randomUUID());
model.setString("Column7", UUID.randomUUID());
model.setString("Column8", UUID.randomUUID());
model.setString("Column9", UUID.randomUUID());
model.insert(); // --> Works fine
model = model.findFirst("ID = 1"); // --> Gives error
} catch (Exception e) {
System.out.println(e.getMessage());
}
if(Base.hasConnection()) {
Base.close();
}
What I don't understand is why is giving that error just for the findFirst
and not for the insert
.我不明白的是为什么只为
findFirst
而不是为insert
给出该错误。 Any idea?任何想法?
The way Instrumentation works is described here: https://javalite.io/instrumentation Instrumentation 的工作方式在此处描述: https://javalite.io/instrumentation
Basically, instrumentation copies byte code of static methods from class Model
into your class.基本上,检测将static方法的字节码从 class
Model
到您的 ZA2F2ED4F8EBC2CBB4C21A29 The instance methods are untouched.实例方法保持不变。 The
findFirst()
method is static and if you want to use it, you need instrumentation. findFirst()
方法是 static,如果你想使用它,你需要检测。 The insert()
is an instance method, and hence does not require instrumentation. insert()
是一个实例方法,因此不需要插桩。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.