Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greendelta/olca-h2
Implementation of the openLCA IDatabase interface with an H2 in-memory database
https://github.com/greendelta/olca-h2
Last synced: 7 days ago
JSON representation
Implementation of the openLCA IDatabase interface with an H2 in-memory database
- Host: GitHub
- URL: https://github.com/greendelta/olca-h2
- Owner: GreenDelta
- License: mpl-2.0
- Created: 2018-03-05T16:13:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-09T12:03:48.000Z (almost 7 years ago)
- Last Synced: 2024-04-16T19:12:38.464Z (8 months ago)
- Language: Java
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# olca-h2
`olca-h2` provides an implementation of the openLCA `IDatabase` interface using
an in-memory instance of an [H2](http://www.h2database.com) database. The import
into `olca-h2` is ~twice as fast compared to an import into a file based Derby
database in openLCA (on a modern SSD drive). Additionally, you can dump such
an `olca-h2` database to a file and reload it into memory later (see below).## Usage
Install the [openLCA core modules](https://github.com/GreenDelta/olca-modules)
and this project via [Maven](https://maven.apache.org/) (you may have to check
the version of the dependencies):```bash
git clone
cd olca-h2 # check the version in the pom.xml
mvn install
```After this you can use `olca-h2` e.g. as plain Maven dependency:
```xml
...1.7.0
...
org.openlca
olca-core
${olca.version}
org.apache.derby
derby
org.openlca
olca-h2
${olca.version}
```
#### Create an empty database
```java
import org.openlca.core.database.IDatabase;
import org.openlca.h2.DB;IDatabase db = DB.empty();
// use it like a standard openLCA database
```#### Dump a database and reload it
```java
import org.openlca.h2.DB;DB db = DB.empty();
// import data ...
db.dump("dump.gz");
DB db2 = DB.fromDump("dump.gz");
```## Updating
`olca-h2` has its own `schema.sql` and `persistence.xml` files. So if there
are database schema or model updates in openLCA these files need to be checked.
The persistence unit is configured to directly take a
[HikariCP](https://github.com/brettwooldridge/HikariCP) connection pool (
`transaction-type="JTA"`)