我收到错误
java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification
我返回此错误的代码是这样的:
public boolean checkAttendance(String userid,String currentdate){
boolean status=false;
List attendanceList=new ArrayList();
Session session = getSessionFactory().openSession();
try {
Transaction tx = session.beginTransaction();
String hql = "select userid from Attendance where userid='"+ userid +"' and date='"+currentdate+"'";
Query query = session.createQuery(hql);
attendanceList = (ArrayList) query.list(); //This Line returning the error
if(attendanceList.size()>0)
{
status=true;
}
tx.commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
session.close();
}
return status;
}
我试图在我的 Context.xml 文件中启用查看 sql
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
hibernate.show_sql=true;
</value>
</property>
我看不到 sql 被执行,我不知道为什么会出现这个错误,因为我的表和字段是正确的。请帮忙。我正在使用 Oracle 11g