org.hibernate.QueryException: could not resolve property: depreciationDay of: com.cqta.oatianai.model.Depreciation

org.hibernate.QueryException: could not resolve property: depreciationDay of: com.cqta.oatianai.model.Depreciation

NO.1 映射出了问题。查找不到。代码如下

 1/**
 2     * 折旧记录检索
 3     */
 4    @SuppressWarnings("unchecked")
 5    public List<Depreciation> queryDepreciationList(String name, String number, Date startTime, Date endTime) {
 6
 7        Criteria criteria = getSession().createCriteria(Depreciation.class, "s").createAlias("s.asset", "a");
 8        // 起始日期
 9        if (startTime != null) {
10            criteria.add(Restrictions.gt("s.depreciationDay ", startTime));
11        }
12        // 截止日期
13        if (endTime != null) {
14            criteria.add(Restrictions.lt("s.depreciationDay ", endTime));
15        }
16        if (name != null && !name.trim().equals("")) {
17            criteria.add(Restrictions.like("a.name", name, MatchMode.ANYWHERE));
18        }
19        if (number != null && !number.trim().equals("")) {
20            criteria.add(Restrictions.like("a.number", number, MatchMode.ANYWHERE));
21        }
22    
23        List<Depreciation> items = criteria.list();
24        DebugUtil.showAllPorperty(items);
25        return items;
26        
27    }

NO.2 仔细核对查找代码中的该属性配置,泪流满面之后 发现属性后面多了个空格........GG...



追逐和梦想一样的激情,暖暖的火焰点燃生命,度过暖暖的每一天...

你可能感兴趣的:(org.hibernate.QueryException: could not resolve property: depreciationDay of: com.cqta.oatianai.model.Depreciation)