运行程序时总是报“com.microsoft.sqlserver.jdbc.SQLServerException : 列名 stuId 无效”
Listlist=this.getSession().createSQLQuery("select*fromCoursecwherec.isFinish='true'an...
List list=this.getSession().createSQLQuery("select * from Course c where c.isFinish='true' and c.id not in"
+" (select courseId from StuCourse sc where sc.stuId = '"+id+"' ) and c.specialtyId in"
+" (select specialtyId from StuUser su where su.id ='"+id+"')").addEntity("c",Course.class).addEntity("sc",StuCourse.class).addEntity("su",StuUser.class).list();
在数据库中可以显示一条记录
并且在表StuCourse 中有字段stuId 展开
+" (select courseId from StuCourse sc where sc.stuId = '"+id+"' ) and c.specialtyId in"
+" (select specialtyId from StuUser su where su.id ='"+id+"')").addEntity("c",Course.class).addEntity("sc",StuCourse.class).addEntity("su",StuUser.class).list();
在数据库中可以显示一条记录
并且在表StuCourse 中有字段stuId 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询