我已经使用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 注入的保护,或者还有其他我需要做的事情......
还提到了另一件事-“始终逃避您的数据”如何实现?