Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

JPA Layer Over Kudu Using Kundera

DZone's Guide to

JPA Layer Over Kudu Using Kundera

See how to set up and configure Kundera, an object mapper that supports a variety of databases and database tools.

· Database Zone
Free Resource

What if you could learn how to use MongoDB directly from the experts, on your schedule, for free? We've put together the ultimate guide for learning MongoDBSign up and you'll receive instructions for how to get started!

Kundera is a "Polyglot Object Mapper" with a JPA interface. Kundera currently supports Cassandra, MongoDB, HBase, Redis, OracleNoSQL, Neo4j, CouchDB, Kudu, Relational databases, and Apache Spark.

New folks should read Getting Started in 5 minutes.

Apache Kudu

Kudu is a columnar storage manager developed for the Hadoop platform. Kudu tables have a structured data model similar to tables in a traditional RDBMS.

Just like SQL, every table has a primary key made up of one or more columns. Rows can be efficiently read, updated, or deleted by their primary key. Kudu's simple data model makes it easy to port legacy applications. Tables are self-describing, so you can use standard tools like SQL engines (e.g. Drill) or Spark to analyze your data.

This new open source complement to HDFS and Apache HBase is designed to fill gaps in Hadoop's storage layer that have given rise to stitched-together, hybrid architectures.

JPA Over Kudu

Kudu is a new addition (in 3.4) to Kundera family. Kundera maps JPA Entity with Kudu Table.

How to Use 

To use it, user needs to add the following dependency in pom.xml:

<dependency>
     <groupId>com.impetus.kundera.client</groupId>
     <artifactId>kundera-kudu</artifactId>
     <version>${kundera.version}</version>
</dependency>

Check out the latest Kundera version here.

Persistence Unit Configuration

<persistence-unit name="kudu_pu">
    <provider>com.impetus.kundera.KunderaPersistence</provider>
    <properties>
        <property name="kundera.nodes" value="quickstart.cloudera" />
        <property name="kundera.port" value="7051" />
        <property name="kundera.keyspace" value="kudutest" />
        <property name="kundera.client" value="kudu" />
        <property name="kundera.ddl.auto.prepare" value="create" />
        <property name="kundera.client.lookup.class" value="com.impetus.client.kudu.KuduDBClientFactory" />
    </properties>
</persistence-unit>

Features

CRUD

Users can Create, Read, Update, and Delete data in Kudu Table using Kundera. Refer to the test-case for details.

Query

Users can perform basic  SELECT  queries with  WHERE  clause. Refer to the test-case for details.

Schema Generation

Users can automatically generate schema using kundera.ddl.auto.prepare property in Persistence Unit. 

Check Kundera documentation for more details about Kundera with Kudu. 

Conclusion

Kundera, being JPA compliant, makes it easier to work with NoSQL databases. Irrespective of the database used, the user needs to write the same JPA query.  Also, if a user wants to switch databases (say from HBase to Kudu), there is no need to rewrite the code — just change some configurations in the persistence.xml  file. 

What if you could learn how to use MongoDB directly from the experts, on your schedule, for free? We've put together the ultimate guide for learning MongoDBSign up and you'll receive instructions for how to get started!

Topics:
kundera ,big data ,hadoop ,kudu ,orm ,jpa

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}