报错日志:
实体User类
@Table("s_user")
public class User {
@Id
private int id;
@Name
@Column
private String userName;
@Column("password")
private String passWord;
@Column("createtime")
private Date createTime;
@Column("status")
private String status;
gets&sets...
mainSetup类
public class MainSetup implements Setup {
@Override
public void destroy(NutConfig conf) {
}
@Override
public void init(NutConfig conf) {
Ioc ioc = conf.getIoc();
Dao dao = ioc.get(Dao.class);
// 初始化数据库表
Daos.createTablesInPackage(dao, "com.gonethen.common", false);
// 初始化数据
if(dao.count(User.class) == 0){
User user = new User();
user.setUserName("admin");
user.setPassWord("qqqqqq");
user.setCreateTime(new Date());
user.setStatus(Constant.STATUS_UNDELETE);
dao.insert(user);
}
}
}
mainModule类
@SetupBy(value=MainSetup.class)
@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/", "*anno", "com.gonethen.common", "*tx"})
@Modules(scanPackage=true)
public class MainModule {
}
dao.js 配置
var ioc = {
dataSource : {
type : "com.alibaba.druid.pool.DruidDataSource",
events : {
create : "init",
depose : 'close'
},
fields : {
url : "jdbc:mysql://127.0.0.1:3306/gonethen",
username : "root",
password : "235711",
testWhileIdle : true,
validationQuery : "select 1",
maxActive : 100
}
},
dao : {
type : "org.nutz.dao.impl.NutDao",
args : [ {
refer : "dataSource"
} ]
}
};
完全跟着nutzbook学着来的,到这里实在找不到原因了,希望有大神给看看,谢谢了。