Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EclipseLink/DesignDocs/350728

Design Specification: Dynamic Named Query definition

ER 350728

Document History

Date Author Version Description & Notes
08 November 2011 Gordon Yorke initial document creation
17 December 2012 Gordon Yorke feature completed

Project overview

With JPA 2.1 the specification has included API to allow dynamically creating named queries and storing these class names for later use.

Concepts

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.

Requirements

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 Constraints

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.

Testing

API

GUI

Config files

Documentation

Work Required

  1. Implement specification API
    approx 2 day
  2. Testing
    approx 2 days

Open Issues

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

Decisions

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

Future Considerations

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.

Back to the top