Hibernate ORM 6.6
Last reviewed Sep 9, 2026
Prompt Details
Prompt Composition
2prompts
- Java 11110 lines · 4.6K tokens
- Hibernate ORM 6.677 lines · 2.9K tokens
Total187 lines · 7.5K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 90
- 95
- 117
- 190
- 208
- 209
- 214
- 250
- 287
- 295
- 297
- 323
- 327
- 338
- 347
- 354
- 362
- 367
- 378
- 427
- 470
- 471
- 494
- 502
- 532
- 611
- 639
- 653
- 732
- 770
- 772
- 776
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 922
Prompt Preview
Apply the Java 11 baseline first. These rules cover Hibernate ORM 6.6.56.Final, which implements Jakarta Persistence 3.1 and runs on JDK 11, 17, 21, 25 from 6.6.40, or 26 from 6.6.49.
Query construction and parameters
- Bind every request-derived value through
setParameteron queries created bycreateQuery,createSelectionQuery,createMutationQuery,createNativeQuery, orcreateStoredProcedureQuery. - Build dynamic predicates with the Jakarta Persistence
CriteriaBuilder, usingparameter()expressions for values, because 6.6 has no typedRestrictionor specification API to fall back on. - Leave
hibernate.criteria.value_handling_modeat itsbinddefault, since theinlinemode renders criteria values as SQL literals instead of JDBC bind parameters. - Keep user input out of
CriteriaBuilder.literal(), which requests SQL literal rendering even when the value handling mode isbind; useparameter()andsetParameterfor explicit bind parameters. - Sort with
Order.asc(SingularAttribute)against the generated static metamodel, and allowlist attribute names before using theOrder.by(Class, String, SortDirection)overload. - Escape or reject
%and_in a finder parameter annotated@Pattern, because the generated code turns that parameter into alikecondition. - Keep the query text in
@HQLand@SQLmetamodel generator methods static, passing every variable value as a method parameter that becomes a bound query parameter. - Set
hibernate.query.fail_on_pagination_over_collection_fetch=true, because thefalsedefault lets a paginated