所以我试图从一个远程只读oracle db 视图获取表数据作为json。我的实体看起来像这样:
Test.java
var results = {
"tab":[
"[[\"2018\",11,\"19\",\"16\",\"13\"],null,null,null,null,null,\"40\"]",
"[[\"2018\",11,\"19\",\"16\",\"19\"],null,null,null,null,null,\"56\"]",
"[[\"2018\",11,\"19\",\"16\",\"21\"],null,null,null,null,\"57\",null]"
]
};
// you can refactor this as a method for more convenient usage, this is just a demo
var row = JSON.parse(results.tab[0]);
// now you just have a multi-dimensional array, use it as normal
console.log(row[0][0]); //year
console.log(row[6]); //number
SubTest.java
@Entity
@Table(schema = "`myschema`", name = "mytable")
public class Test extends Model {
@Column
public String description;
@Column
public String enginenum;
public List<SubTest> subtest;
public static final Finder<String, Test> find = new Finder<>(Test.class, "mydbname");
MyController.java
@Entity
@Table(schema = "`myschema`", name = "mytable")
public class SubTest extends Model {
@Column
public String site;
@Column
public String unitnum;
public Test test;
我能够从Test模型获取描述和enginenum到我的json数组,但是List将返回为空。我应该映射这些模型之间的关系吗?一个只读视图甚至有可能吗?