-
Notifications
You must be signed in to change notification settings - Fork 35
Persistence Providers
Trooper Persistence library is designed around Entities (domain objects) and PersistenceProvider(s) that are mostly interchangeable. Implementations include SQL and NoSQL providers.
See Persistence Framework for details around design and usage of the persistence libraries.
The following common Maven artifacts are required across all persistence providers
GroupID/Org | ArtifactID/Name | Description |
---|---|---|
org.trpr | platform-model | XML schema project that defines common data types/structures |
org.trpr | platform-core | Core API for persistence and default implementations where relevant. Also includes features like sharding and mapping persistence entities to providers. |
Each of the following Maven artifacts are data-store specific implementations of the Persistence Provider API.
GroupID/Org | ArtifactID/Name | Description |
---|---|---|
org.trpr | dataaccess-orm | RDBMS persistence provider built over Hibernate ORM library |
org.trpr | dataaccess-hbase | Hadoop HBase persistence provider built over the HBase Java client library. Provides XML based mapping of entities to HBase table, column families and columns. |
The examples below show representative usage of the persistence providers:
The Persistence Sharding page demonstrates an example of using the RDBMS provider that is implemented over Hibernate ORM library.
This example Trooper Batch Job demonstrates using the HBase persistence provider to perform CRUD operations in HBase:
Trooper/examples/example-hbase/src/main/resources/external/hbaseTestTaskletJob/spring-batch-config.xml
The sample below shows XML based mapping of entities to HBase (in a manner similar to Hibernate ORM):
<?xml version="1.0" encoding="UTF-8"?>
<hbase-mapping
xmlns="http://org/trpr/dataaccess/hbase/model/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<hbase-class name="org.trpr.example.batch.hbase.test.entity.HBaseEarthling" table="mytable">
<rowkey-definition valueAttribute="uid" valueType="java.lang.String" />
<column-definition columnFamily="demodata" columnQualifier="name" valueAttribute="name" valueType="java.lang.String" />
<column-definition columnFamily="demodata" columnQualifier="intValue" valueAttribute="intValue" valueType="java.lang.Integer" />
<column-definition columnFamily="demodata" columnQualifier="longValue" valueAttribute="longValue" valueType="java.lang.Long" />
<column-definition columnFamily="demodata" columnQualifier="byteArrayValue" valueAttribute="byteArrayValue" valueType="byte[]" />
<column-definition columnFamily="demodata" columnQualifier="dateValue" valueAttribute="dateValue" valueType="java.util.Date" />
</hbase-class>
</hbase-mapping>