Hibernate会话以小写形式生成具有表名的查询,例如:
type = Employee.class但table是EMPLOYEE
但查询是 *** from Emloyee where ***
而且因为这个表的SQL异常不存在!!
result = session.createCriteria(type).add(Restrictions.eq(“Id”,Id)) . list();
提前致谢!!
SQL is case insensitive所以这两个选择是等价的:
select * from Emloyee where id = 1 SELECT * FROM EMLOYEE WHERE ID = 1
当你的表位于Hibernate不知道的不同模式时,确保Hibernate不会尝试针对PUBLIC模式进行选择 .
1 回答
SQL is case insensitive所以这两个选择是等价的:
当你的表位于Hibernate不知道的不同模式时,确保Hibernate不会尝试针对PUBLIC模式进行选择 .