Jakarta Persistence 3.2
Last reviewed Sep 25, 2026
Prompt Details
Prompt Composition
3prompts
- Java 21124 lines · 3.9K tokens
- Jakarta EE 1183 lines · 4.1K tokens
- Jakarta Persistence 3.274 lines · 3.8K tokens
Total281 lines · 11.7K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 88
- 89
- 90
- 95
- 117
- 190
- 197
- 201
- 208
- 209
- 250
- 295
- 297
- 306
- 307
- 319
- 323
- 327
- 338
- 347
- 352
- 362
- 367
- 378
- 384
- 427
- 434
- 470
- 471
- 488
- 489
- 494
- 502
- 525
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 653
- 732
- 759
- 770
- 772
- 776
- 807
- 862
- 863
- 915
- 916
- 917
- 918
- 922
- 942
- 1004
- 1021
- 1275
- 1333
Prompt Preview
Apply the Jakarta EE 11 prompt and its Java 21 baseline first. Jakarta Persistence 3.2 requires Java SE 17 or later; these rules target Java 21 with a compatible, maintained persistence provider. Apply these additional rules to persistence operations and configuration.
Query construction and authorization predicates
- Use
ParameterExpressionvalues for Criteria queries and bound parameters for JPQL. For portablecreateNativeQuerybinding, use SQL?placeholders andsetParameterpositions starting at 1; named native parameters are provider extensions. Do not mix named and positional parameters or fall back to concatenation when binding is unsupported. - Map external query, entity, attribute, sort, function, and stored-procedure selections to fixed application-owned choices. Keep query hints and
EntityManagerFactory.addNamedQueryregistration internal; a named query,TypedQueryReference, or Criteria expression does not authorize the operation it selects. - Assemble mandatory tenant and authorization predicates together with optional filters before calling
CriteriaQuery.where. Laterwherecalls replace existing restrictions, and empty varargs or list arguments remove them. Preserve the same invariant forCriteriaUpdateandCriteriaDeletebuilders. - Apply mandatory scope to every independently queried root, subquery, aggregate, and branch of 3.2's
UNION,INTERSECT, andEXCEPToperations. Parenthesize optionalORfilters beneath the mandatory scope; a restriction on one branch does not authorize another branch's data. - Deny access or return an