NutzCN Logo
问答 关于报错Can not find @Column(PROJECTNAME) in table/view ()
发布于 2680天前 作者 qq_7fafbecc 2824 次浏览 复制 上一个帖子 下一个帖子
标签:

这是报错信息
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(PDTYPETEXT) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(ISEMERGENCYTEXT) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(PROJECTNAME) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(CREATERNAME) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(HANDLERNAME) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(PDSTATETEXT) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(CURRENTOPERATORNAME) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(ISTESTTEXT) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(TESTERNAME) in table/view ()
2017-07-15 23:20:47,688 org.nutz.dao.util.Daos.getColumnIndex(Daos.java:127) INFO - Can not find @Column(ISFINISHTEXT) in table/view ()

SQL语句是:
select a.*,(select b.PROJECTNAME from PROJECT b where b.PROJECTID = a.projectid) projectName from PROBLEMDEMAND a order by a.pdId desc。

实体类:
@Table("PROBLEMDEMAND")
public class ProblemDemand {
@Name
@Column("PDID")
//问题需求编号,由程序生成
private String pdId;
.............
@Readonly
@Column("PDTYPETEXT")
private String pdTypeText;

@Readonly
@Column("ISEMERGENCYTEXT")
private String isEmergencyText;

@Readonly
@Column("PROJECTNAME")
private String projectName;

@Readonly
@Column("CREATERNAME")
private String createrName;

@Readonly
@Column("HANDLERNAME")
private String handlerName;

@Readonly
@Column("PDSTATETEXT")
private String pdStateText;

@Readonly
@Column("CURRENTOPERATORNAME")
private String currentOperatorName;

@Readonly
@Column("ISTESTTEXT")
private String isTestText;

@Readonly
@Column("TESTERNAME")
private String testerName;

@Readonly
@Column("ISFINISHTEXT") 
private String isFinishText;
18 回复

并不影响运行吧

PROBLEMDEMAND表中,确实没有PROJECTNAME字段,但是在实体类中定义了啊
@Readonly
@Column("PROJECTNAME")
private String projectName;

同样的情况,我另一个方法中的SQL
select a.*,(select b.DEPTNAME from DEPT b where b.DEPTCODE = a.deptcode) deptName from SYSUSER a

另一个实体类:
@Column("DEPTNAME")
@Readonly
private String deptName;

SYSUSER 数据库表中没有DEPTNAME这个字段,却能通过以上SQL,查出数据

为什么同样的套路,在SYSUSER可以查出数据,在PROBLEMDEMAND又查不出了呢

@wendal 急死了,礼拜一要交差,能帮忙指教一下吗

仅PROJECTNAME没值,其他属性都有值?

在PROBLEMDEMAND数据库表中真正有字段的,都没这个提示.
但整个SQL语句查不出记录

		List<ProblemDemand> rval = new ArrayList<ProblemDemand>();
		String sqlstr = "select a.*,"
				//+ "(select b.codename from CODEMNG b where b.CODETYPE = 'PDTYPE' and b.CODE = a.pdtype) PDTYPETEXT,"
				//+ "(select b.codename from CODEMNG b where b.CODETYPE = 'ISEMERGENCY' and b.CODE = a.ISEMERGENCY) ISEMERGENCYTEXT,"
				+ "(select b.PROJECTNAME from PROJECT b where b.PROJECTID = a.projectid) projectName "
				//+ "(select b.DISPLAYNAME from SYSUSER b where b.userid = a.CREATER) CREATERNAME,"
				//+ "(select b.DISPLAYNAME from SYSUSER b where b.userid = a.HANDLER) HANDLERNAME,"
				//+ "(select b.codename from CODEMNG b where b.CODETYPE = 'PDSTATE' and b.CODE = a.pdstate) PDSTATETEXT,"
				//+ "(select b.DISPLAYNAME from SYSUSER b where b.userid = a.CURRENTOPERATOR) CURRENTOPERATORNAME,"
				//+ "(select b.codename from CODEMNG b where b.CODETYPE = 'ISTEST' and b.CODE = a.istest) ISTESTTEXT,"
				//+ "(select b.DISPLAYNAME from SYSUSER b where b.userid = a.TESTER) TESTERNAME,"
				//+ "(select b.codename from CODEMNG b where b.CODETYPE = 'ISFINISH' and b.CODE = a.ISFINISH) ISFINISHTEXT "
				+ "from PROBLEMDEMAND a";
		String _pdId = pdId.trim();
		if(_pdId!=null && !"".equals(_pdId)){
			sqlstr = sqlstr + " where a.pdid = '"+_pdId+"'";
		}
		sqlstr = sqlstr + " order by a.pdId desc";
		Sql sql = Sqls.create(sqlstr);
		sql.setCallback(Sqls.callback.entities());
		
		sql.setEntity(dao.getEntity(ProblemDemand.class));
		dao.execute(sql);

		rval = sql.getList(ProblemDemand.class);
		return rval;

最后rval 中是空的

真个实体类如下
@Table("PROBLEMDEMAND")

public class ProblemDemand {

@Name
@Column("PDID")
//问题需求编号,由程序生成
private String pdId;

@Column("PDTYPE")
//类型(1问题,2需求)
private String pdType;

@Column("ISEMERGENCY")
//是否紧急
private String isEmergency;

@Column("PROJECTID")
//项目编号
private String projectId;

@Column("TITLE")
//标题
private String title;

@Column("CONTENTS")
//详细内容
private String contents;

@Column("WISHEFFECT")
//希望达到的效果
private String wishEffect;

//希望几天完成
@Column("WISHFINISHDAYS")
private int wishFinishDays;

//创建者
@Column("CREATER")
private String creater; 

//创建时间
@Column("CREATETIME")
private Date createTime; 

//接手人
@Column("HANDLER")
private String handler; 

//当前状态
@Column("PDSTATE")
private String pdState; 

//当前经办人
@Column("CURRENTOPERATOR")
private String currentOperator; 

//是否测试过
@Column("ISTEST")
private String isTest; 

//测试人
@Column("TESTER")
private String tester; 

//是否完结
@Column("ISFINISH")
private String isFinish; 

//完结时间
@Column("FINISHTIME")
private Date finishTime; 

//耗时天数
@Column("FINISHDAYS")
private String finishDays; 


@Readonly
@Column("PDTYPETEXT")
private String pdTypeText;

@Readonly
@Column("ISEMERGENCYTEXT")
private String isEmergencyText;

@Readonly
@Column("PROJECTNAME")
private String projectName;

@Readonly
@Column("CREATERNAME")
private String createrName;

@Readonly
@Column("HANDLERNAME")
private String handlerName;

@Readonly
@Column("PDSTATETEXT")
private String pdStateText;

@Readonly
@Column("CURRENTOPERATORNAME")
private String currentOperatorName;

@Readonly
@Column("ISTESTTEXT")
private String isTestText;

@Readonly
@Column("TESTERNAME")
private String testerName;

@Readonly
@Column("ISFINISHTEXT") 
private String isFinishText;

```

日志里面出sql没?

@Readonly的,数据库表中都没字段的

rval中的什么是null?

出了,肯定执行了

ProblemDemand.projectName居然有值

我把SQL的注释取消,可以取到了,rval对象中的属性都有值了,居然忘记检查最后返回的值了
晕死,只注意Can not find @Column(PDTYPETEXT) in table/view ()了,呵呵
谢谢 @wendal

额,那到底最初的时候错了啥?

因为最初,我页面记录没刷出来,然后控制台又出现了Can not find @Column,我就以为没LIS里没值,实际上是有的,已经赋进去了。
现在剩下的问题,就是为什么中间层的对象的值,为什么没展现在页面了

页面逻辑有问题?

来自美丽的 NutzCN

添加回复
请先登陆
回到顶部