我使用Hibernate来操作我的数据库,现在我想让我的数据库层免受SQL注入攻击,所以我进行了一些研究,发现我的查询应该是参数化的。那么这是否意味着,如果我将我的HQL查询结构化为:
List mothers = session.createQuery(
"select mother from Cat as cat join cat.mother as mother where cat.name = ?")
.setString(0, name)
.list();
然后将其参数化并保护免受SQL注入攻击,或者还需要进行其他操作吗...
还有一件事被提到 - "始终转义您的数据" 如何实现??