1 @Repository("proModuleDao")
2 @Scope("singleton")
3 @SuppressWarnings("unchecked")
4 public class ProModuleDao extends BaseDao<ProductModule> implements IProModuleDao{
5
6 public List<ProductModuleExtention> listProductModuleExtentionByPid(int pid) {
7 String sql = "select "
8 + "pm.*,"
9 + "pmv1.conval as colourValue,"
10 + "pmv2.conval as sizeValue "
11 + "from t_pro_module pm left join "
12 + "t_pro_module_values pmv1 "
13 + "on pm.colourkey = pmv1.conkey "
14 + "left join t_pro_module_values pmv2 "
15 + "on pm.sizekey = pmv2.conkey "
16 + "where pid = ?";
17 return this.getSession().
18 createSQLQuery(sql).
19 setResultTransformer(Transformers.aliasToBean(ProductModuleExtention.class)).
20 setParameter(0, pid).list();
21 }
22
23 }
这段代码一直报出java.sql.SQLException: Column ‘conval’ not found.的异常,排查了很久都没有结果,所以只好求助万能的搜索引擎,终于发现了前辈的解答,也不枉我排查了一下午。
戳我查看