Skip to content

Commit 147cf6b

Browse files
committed
remove CAUTION from doc because actually this is safe enough
1 parent a438474 commit 147cf6b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

documentation/src/main/asciidoc/introduction/Interacting.adoc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -705,14 +705,11 @@ query.select(book).where(where)
705705

706706
Here, as before, the classes `Book_` and `Author_` are generated by Hibernate's <<metamodel-generator,JPA Metamodel Generator>>.
707707

708-
[CAUTION]
708+
[NOTE]
709709
// .Injection attacks and criteria queries
710710
====
711711
Notice that we did not bother treating `titlePattern` and `namePattern` as parameters.
712-
That's safe because, _by default_, Hibernate automatically and transparently handles any literal string passed to the `CriteriaBuilder` as a JDBC parameter.
713-
714-
But this behavior is controlled by the configuration setting `hibernate.criteria.value_handling_mode`.
715-
If you change the default behavior, and set the property to `INLINE` instead of `BIND`, you _must_ pass user-input via a JPA `ParameterExpression`.
712+
That's safe because, by default, Hibernate automatically and transparently treats strings passed to the `CriteriaBuilder` as JDBC parameters.
716713
====
717714

718715
Execution of a criteria query works almost exactly like execution of HQL.
@@ -1214,4 +1211,5 @@ In this section we'll quickly sketch some general strategies for avoiding "quagm
12141211
Instead, _understand_ what you're doing; study the Javadoc of the APIs you're using; read the JPA specification; follow the advice we give in this document; go direct to the Hibernate team on Zulip.
12151212
(Sure, we can be a bit cantankerous at times, but we _do_ always want you to be successful.)
12161213
- Always consider other options.
1217-
You don't have to use Hibernate for _everything_.
1214+
You don't have to use Hibernate for _everything_.
1215+

0 commit comments

Comments
 (0)