NutzCN Logo
问答 系统启动后提示找不到字段
发布于 2614天前 作者 qq_30fdbc0f 1600 次浏览 复制 上一个帖子 下一个帖子
标签:

如下代码所示:多表联查,pojo类中标识@Readonly的字段在表中没有,但在该方法的结果集中有,每次项目启动后提示找不到字段,这种情况如何合理的处理:

	public List<LatestTrendst> list(){
		Sql sql = Sqls.create("select a.res_id,a.act,a.create_time,b.res_title, b.res_type_name,c.user_name,c.user_icon from (select * from yb_latest_trendst order by create_time desc limit 3) as a left join res_info_view b on a.res_id = b.res_id left join user_param_view c on a.user_id = c.user_id");
		sql.setCallback(Sqls.callback.entities());
		sql.setEntity(this.dao().getEntity(LatestTrendst.class));
		this.dao().execute(sql);
		return sql.getList(LatestTrendst.class);
	}
import java.sql.Timestamp;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Readonly;
import org.nutz.dao.entity.annotation.Table;

@Table("yb_latest_trendst")
public class LatestTrendst{

	@Id(auto = true)
	private Long id;
	@Column("user_id")
	private Long userId;
	@Column("res_id")
	private Long resId;
	@Column("act")
	private String act;
	@Column("create_time")
	private Timestamp createTime;
	@Readonly
	@Column("res_title")
	private String resTitle;
	@Readonly
	@Column("res_type_name")
	private String resTypeName;
	@Readonly
	@Column("user_name")
	private String userName;
	@Readonly
	@Column("user_icon")
	private String userIcon;
8100-9] INFO  org.nutz.dao.util.Daos -Can not find @Column(res_title) in table/view (yb_latest_trendst)
2017-02-28 15:46:04,648 [resin-tcp-connection-*:8100-9] INFO  org.nutz.dao.util.Daos -Can not find @Column(res_type_name) in table/view (yb_latest_trendst)
2017-02-28 15:46:04,648 [resin-tcp-connection-*:8100-9] INFO  org.nutz.dao.util.Daos -Can not find @Column(user_name) in table/view (yb_latest_trendst)
2017-02-28 15:46:04,648 [resin-tcp-connection-*:8100-9] INFO  org.nutz.dao.util.Daos -Can not find @Column(user_icon) in table/view (yb_latest_trendst)
2 回复

是有点不雅,对吧... org.nutz.util.Daos的日志改高一点点吧

秒回啊,谢谢wendal

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