Query and Modify Data
Use the methods and query features supported by the selected provider. The following table identifies the covered categories.
| Category | API or Method Form | Usage |
|---|---|---|
| Standard operation | BasicRepository and CrudRepository |
Supported find/save/insert/update/delete and bulk forms |
| Lifecycle method | @Insert, @Update, @Save, @Delete |
Supported parameter and result types |
| Query method | @Find, @Query, Query by Method Name |
Parameter binding and supported query forms |
| Result control | Order, limits, pages, supported cursors |
Result order and amount of returned data |
| Default method | Java interface default method | Composition of repository operations |
| Custom method | Supported declaration/resource accessor | Applicable provider resource contract |
Define a Derived and an Annotated Query
For an entity with a persistent name field, these methods demonstrate Query by Method Name and an annotated query. Add them to a repository whose entity type is CustomerDocument.
List<CustomerDocument> findByName(String name);
@Query("WHERE name = ?1")
List<CustomerDocument> findByNameWithQuery(String name);
The example uses java.util.List and jakarta.data.repository.Query. The query form comes from the NoSQL provider example. Use the syntax applicable to the selected provider.
For supported JPA boolean count-exists forms, WebLogic Server binds named or positional parameters and adapts supported numeric counts to boolean.
Order and Page Query Results
Use deterministic ordering for paged queries. This method illustrates a parameter-based NoSQL query with a page request and dynamic ordering.
@Find
Page<CustomerDocument> findByNameWithPage(
@By("name") String name,
PageRequest pageRequest,
Order<CustomerDocument> order);
The method uses jakarta.data.repository.Find, jakarta.data.repository.By, jakarta.data.page.Page, jakarta.data.page.PageRequest, and jakarta.data.Order. It requires a mapped name field.
WebLogic Server provides a set of code examples and sample applications that show several approaches to learning about and working with WebLogic Server. These examples and sample applications are available through a separate WebLogic Server examples installer. See Sample Applications and Code Examples in Understanding Oracle WebLogic Server for instructions on installing and running the examples.
The WebLogic Server Jakarta Data/NoSQL sample provides a simple application example. Use the repository API and provider-specific guidance for features beyond the sample. Retained streams, iterators, cursors, and prepared operations remain tied to the resource configuration generation that created them.