用到dao.query时 发生空指针,发现是Nutdao的pojoMaker和holder对象为null 。请问这是为何?
程序如下
var ioc = {
dataSource: {
type: "org.apache.tomcat.dbcp.dbcp.BasicDataSource",
singleton: true,
events: {
depose : 'close'
},
fields: {
driverClassName: "com.ibm.db2.jcc.DB2Driver",
url: "jdbc:db2://localhost:50000/QGETC",
username: "db2admin",
password: "111111",
maxWait: 15000,
defaultAutoCommit: false,
validationQuery: "SELECT 'X'",
testWhileIdle: true,
testOnBorrow: false,
testOnReturn: false,
timeBetweenEvictionRunsMillis: 60000,
minEvictableIdleTimeMillis: 300000,
initialSize: 0,
minIdle: 1,
maxActive: 20,
removeAbandoned: true,
removeAbandonedTimeout: 3600000,
poolPreparedStatements: true,
maxPoolPreparedStatementPerConnectionSize: 20 // 指定每个连接上PSCache的大小
}
},
dao : {
type : "org.nutz.dao.impl.NutDao",
fields : {
dataSource : {refer : 'dataSource'}
}
}
};
@Modules({LoginController.class})
@Fail("json")
@IocBy(type=JsonIocProvider.class, args={"./ioc/dao.js"})
public class MainModule {
}
@Ok("json")
public class LoginController {
@At("/yousay")
public String sayMore(@Param("username") String username,
@Param("age") String age) {
Dao dao = new NutDao();
List<user> list = dao.query(user.class, null, null);
String jsonStr = Json.toJson(list);
return str;
}
}
@Table("TUSER")
public class user {
public user() {}
@Name
private Long userId;
@Column
private String userName;
@Column
private String realName;
@Column
private String passWord;
@Column
private Integer right;
@Column
private Integer active;
getset省略。。。
}