Git Product home page Git Product logo

fuse-camel-hibernate-jpa's Introduction

Camel Hibernate JPA: demonstrates Camel JPA and Hibernate Persistence

Author: Matt Robson

Technologies: Fuse, OSGi, Camel, Hibernate, Blueprint, Karaf Features, Fuse BOM, Aries Auto Enlist XA Transactions

Product: Fuse 6.2.1

Breakdown

This code example shows how to leverage Camel JPA and persist Entities using Hibernate. It demonstrates how to wire an EntityManager to a JPA Context and on to a Camel JPA component. It also makes use of Aries Auto Enlistment for XA Transactions. Other interesting aspects include the use of the Fuse BOM, Karaf Features and Blueprint Placeholders.

For more information see:

System Requirements

Before building and running this quick start you need:

  • Maven 3.2 or higher
  • Java 1.7 or 1.8
  • JBoss Fuse 6.2.1

Build and Deploy

  1. clone this project

    git clone https://github.com/mrobson/fuse-camel-hibernate-jpa.git

  2. change to project directory

    cd fuse-camel-hibernate-jpa

  3. update your username and password

    vi camel-hibernate-xa-datasource/src/main/resources/OSGI-INF/blueprint/datasource.xml <cm:property name="datasource.username" value="username" /> <cm:property name="datasource.password" value="password" />

  4. build

    mvn clean install

  5. start JBoss Fuse 6.2.1

    ./fuse or ./start

  6. start Oracle database (refer to vendor documentation if you need to do this, for easy testing I recommend using Oracle XE)

  7. deploy Oracle JDBC driver

Download the latest driver from Oracle and install it to your local maven repository (account required):

mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=12.1.0.1 -Dpackaging=jar
  1. add the features file

    features:addurl mvn:org.mrobson.example.hibernatetx/features/1.0-SNAPSHOT/xml/features

  2. install

    features:install hibernate-camel-jpa-example

  3. verify

    osgi:list [ 353] [Active ] [Created ] [ ] [ 90] camel-hibernate-jpa :: XA-Datasource (1.0.0.SNAPSHOT) [ 354] [Active ] [Created ] [ ] [ 95] camel-hibernate-jpa :: Datamodel (1.0.0.SNAPSHOT) [ 355] [Active ] [Created ] [ ] [ 100] camel-hibernate-jpa :: Camel JPA Hibernate (1.0.0.SNAPSHOT)

Usage

Copy the example person XML from the project to the processing directory where Camel will pick it up, unmarshall and persist the person to the DB

cp camel-hibernate-route/src/test/resources/person.xml $FUSE_HOME/data/camel/

Create a new file (with a new name) and copy it in, Camel will pick up any file placed into that directory

Remove the Services

To remove the bundle we installed, you can simply uninstall the feature:

  1. uninstall the feature

    features:uninstall hibernate-camel-jpa-example

Done!

fuse-camel-hibernate-jpa's People

Contributors

mrobson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.