8 Using Jakarta Data Repositories and NoSQL Resource References
Learn how to use Jakarta Data repositories with NoSQL resources in Oracle WebLogic Server and how application resource references map to configured NoSQL system resources.
- Use a Repository from an Enterprise Bean
An enterprise bean can inject an eligible Jakarta Data repository. Discovery includes supported EJB modules within an EAR, subject to CDI eligibility, visibility, and the owning deployment's supported scope. - Declare an EJB-Scoped NoSQL Reference
For a NoSQL repository, declare a local reference of typeorg.eclipse.jnosql.communication.semistructured.DatabaseManagerfor the consuming bean. Supply the corresponding explicit JNDI mapping under the same effective EJB identity. - Apply Security and Lifecycle Rules
ConfigureNoSQLResourceaccessfor the global management-resource name. WebLogic Server evaluates the current subject on guarded use. The deployer or original handle recipient does not permanently authorize later calls. EJB roles, targeting, and JNDI mappings do not substitute for the resource policy. Calling-application ownership also applies to retained capabilities.
Use a Repository from an Enterprise Bean
An enterprise bean can inject an eligible Jakarta Data repository. Discovery includes supported EJB modules within an EAR, subject to CDI eligibility, visibility, and the owning deployment's supported scope.
See About Jakarta Data Applications in Developing Jakarta Data Applications for Oracle WebLogic Server.
Jakarta Persistence-backed repository operations use the selected visible persistence unit and applicable JTA transaction contract. NoSQL-backed repository operations do not participate in JTA global transactions, including when called from a bean with container-managed transactions. Do not infer NoSQL XA enlistment or global rollback from the EJB transaction attribute.
Declare an EJB-Scoped NoSQL Reference
For a NoSQL repository, declare a local reference of type org.eclipse.jnosql.communication.semistructured.DatabaseManager for the consuming bean. Supply the corresponding explicit JNDI mapping under the same effective EJB identity.
The following table identifies the required descriptor relationship.
| Descriptor | Required Content | Identity Check |
|---|---|---|
META-INF/ejb-jar.xml |
Standard resource-ref or supported
resource-env-ref under the consuming bean
|
Local alias and full DatabaseManager type |
META-INF/weblogic-ejb-jar.xml |
Matching resource-description or
resource-env-description under
weblogic-enterprise-bean |
Same ejb-name, alias, and reference kind
|
| Global NoSQL descriptor | One valid matching JNDI binding targeted locally | Intended global management-resource identity |
Another bean's mapping or a sibling WAR cannot supply a missing same-scope mapping. Matching alias text alone does not bridge EJB identities.
For illustrative descriptor fragments, see Package an EJB Binding in Administering NoSQL Resources for Oracle WebLogic Server. Merge the fragments into the application's descriptors using the release roots, namespaces, schemas, and element order.
Complete packaged pairs need no plan. Environment-specific overrides remain subject to the same EJB identity, declaration/type, and mapping rules. Review effective descriptors after applying the plan. See Apply a Deployment-Plan Override in Administering NoSQL Resources for Oracle WebLogic Server.
Apply Security and Lifecycle Rules
Configure NoSQLResource access for the global management-resource name. WebLogic Server evaluates the current subject on guarded use. The deployer or original handle recipient does not permanently authorize later calls. EJB roles, targeting, and JNDI mappings do not substitute for the resource policy. Calling-application ownership also applies to retained capabilities.
Repositories in one deployment using the WebLogic NoSQL system-resource path must select one bound global identity. The binding remains fixed for that deployment generation; compatible property updates can advance configuration generations behind stable handles. Reacquire former-generation retained capabilities.
If resource changes terminally invalidate the deployment, restore the intended configuration and fully redeploy the affected application. For an EJB within an EAR, do not assume a module-only refresh establishes the required new application generation. See Deploying Applications to Oracle WebLogic Server and Update a Resource and Recover Applications in Administering NoSQL Resources for Oracle WebLogic Server.