# reactive-components
**Repository Path**: xiaobin268/reactive-components
## Basic Information
- **Project Name**: reactive-components
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-03-10
- **Last Updated**: 2021-03-10
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# reactive-components
Java reactive components
## reactive-jpa
DEPRECATED!!! PLEASE REVIEW https://hibernate.org/reactive/
Library that provide a wrapper for JDBC (Blocking API) with reactive components (Project Reactor) using Java Persistent API (Hibernate).
### How to use
#### Install
**Maven**
```xml
...
snapshots-repo
https://oss.sonatype.org/content/repositories/snapshots
true
...
...
com.ibm.reactivecomponents
reactive-jpa
0.0.1-SNAPSHOT
...
```
**Gradle**
```groovy
repositories {
...
maven {
url 'https://oss.sonatype.org/content/groups/staging'
}
...
}
dependencies {
...
compile('com.ibm.reactivecomponents:reactive-jpa:0.0.1-SNAPSHOT')
...
}
```
#### Initialize
```java
Map settings = new HashMap<>();
settings.put("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
settings.put("hibernate.connection.url", "jdbc:hsqldb:mem:test");
settings.put("hibernate.connection.username", "sa");
settings.put("hibernate.show_sql", "true");
settings.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
settings.put("hibernate.hbm2ddl.auto", "update");
List packages = new ArrayList<>(1);
packages.add(Person.class.getPackage().getName()); // list of java packages with Entities
Database database = new Database(settings, packages);
```
#### Transaction
```java
Person p1 = new Person("Person 1");
Person p2 = new Person("Person 2");
Mono mono = database
.execute(entityManager -> {
entityManager.persist(p1);
entityManager.persist(p2);
return p1;
})
.transaction(
TransactionDefinition
.builder()
.isolation(IsolationLevel.SERIALIZABLE)
.timeout(5)
.build()
)
.mono();
```
#### Stream - Hibernate ScrollableResults
```java
Flux result = database
.stream("from PERSON person", Person.class)
.fetchSize(10)
.maxResults(100)
.firstResult(1)
.isolationLevel(IsolationLevel.READ_COMMITTED)
.flux();
```
[](https://travis-ci.com/IBM/reactive-components)
[](https://codecov.io/gh/IBM/reactive-components)