java.sql.SQLIntegrityConstraintViolationException: ORA-01400: 无法将 NULL 插入 (表)

写了一个注册Action,一些文本框没填写内容,测试执行插入数据库操作,一直报错:

java.sql.SQLIntegrityConstraintViolationException: ORA-01400: 无法将 NULL 插入 ("ROOT"."DOCTORINFO"."USERNAME")

 然后在插入操作前判断插入数据是否为空,为空不执行

if(null != doctor.getUserName() ){
res = doctordao.insertMessage(doctor);
}


这样还报同样的错误,另添加判断为""  

if(null != doctor.getUserName() && doctor.getUserName().equals("")){
res = doctordao.insertMessage(doctor);
}

测试没有无法将NULL插入 错误。


版权声明:本文为u012753570原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。