https://github.com/tnas/qsplitter
Tool to assist in strategies against errors ORA-01795 and ORA-00913.
https://github.com/tnas/qsplitter
criteria-api hibernate-jpa java11 oracle performance sql
Last synced: about 1 year ago
JSON representation
Tool to assist in strategies against errors ORA-01795 and ORA-00913.
- Host: GitHub
- URL: https://github.com/tnas/qsplitter
- Owner: tnas
- License: epl-2.0
- Created: 2024-09-17T18:24:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-23T12:51:35.000Z (over 1 year ago)
- Last Synced: 2024-10-23T15:23:59.200Z (over 1 year ago)
- Topics: criteria-api, hibernate-jpa, java11, oracle, performance, sql
- Language: Java
- Homepage:
- Size: 10.6 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# QSplitter
A simple tool to help developers implement strategies to work around [ORA-01795](https://docs.oracle.com/en/error-help/db/ora-01795/index.html?r=23ai) and [ORA-00913](https://docs.oracle.com/en/error-help/db/ora-00913/?r=23ai) errors.
## Usage
Add this dependency to the `pom.xml`:
```xml
io.github.tnas
qsplitter
1.0.0
```
## Class Diagram
To describe how to use the implemented strategies, assume the following classes
presented in the diagram below.
```mermaid
classDiagram
User: -Long id
User: -String name
User: -String email
User: -String streetName
User: -String city
User: -String country
class UserId
UserId: -Long id
User "1" --> "1" UserId
```
All strategies were implemented for JPA Criteria API. The next sections describe how to use
the lib in the Java code.
## N Queries Strategy
```java
// Objects that must be provided by the application
EntityManager em;
List ids;
CriteriaQuery query;
var qSplitterDao = new NQueriesDao(em);
var entities = this.qSplitterDao.select(ids, query, User_.id);
assertEquals(503, entities.size());
```
## Disjunctions of Expression Lists
```java
static final int TOTAL_RECORDS = 99765;
// Objects that must be provided by the application
EntityManager em;
List ids;
CriteriaQuery query;
var qSplitterDao = new DisjunctionsDao(em);
var entities = this.qSplitterDao.select(ids, query, User_.id);
assertEquals(503,entities.size());
```
## Temporary Table
```java
// Objects that must be provided by the application
EntityManager em;
List ids;
CriteriaQuery query;
var qSplitterDao = new TempTableDao(em);
var tempRelation = new TableRelationship(UserId.class, Long.class, User_.replicatedId);
var entities = this.qSplitterDao.select(ids, query, tempRelation);
assertEquals(503,entities.size());
```
## References
Access the DZone article to learn more details about the tool: [Workarounds for Oracle Restrictions on the Size of Expression Lists](https://dzone.com/articles/workarounds-for-oracle-restrictions)