Design Specification: Dynamic Named Query definition
|Date||Author||Version Description & Notes|
|08 November 2011||Gordon Yorke||initial document creation|
|17 December 2012||Gordon Yorke||feature completed|
With JPA 2.1 the specification has included API to allow dynamically creating named queries and storing these class names for later use.
Within JPA users can statically define Named Queries using annotations or XML. These queries can then be accessed by name from the Entity Manager and executed. This new API allows the Named Query to be defined at runtime and stored in the active Entity Manager Factory.
Implement EntityManagerFactory.addNamedQuery APIs. Ensure any configuration of the query object(ie max results, hints, flush mode, lock mode,etc) (except for actual parameter binding) in effect when the named query is added is retained as part of the named query definition. If a named query of the same name has been previously defined, either statically via metadata or via this method, that query definition is replaced.
Design / Functionality
Simply add api to add query objects to the session's named queries as we do for statically defined named queries. Updated interface to take a boolean for requiring unique query names.
- Implement specification API
- approx 2 day
- approx 2 days
This section lists the open issues that are still pending that must be decided prior to fully implementing this project's requirements.
|Issue #||Owner||Description / Notes|
This section lists decisions made. These are intended to document the resolution of open issues or constraints added to the project that are important.
|Issue #||Description / Notes||Decision|
During the research for this project the following items were identified as out of scope but are captured here as potential future enhancements. If agreed upon during the review process these should be logged in the bug system.