GithubHelp home page GithubHelp logo

atomium's Introduction

Atomium build_status_img

A simple ORM for your Java projects

How to use

You can download the generated artifacts here, compile yourself or use Maven dependency system.

Compile the artifacts

$ git clone https://github.com/Blackrush/Atomium.git
$ cd Atomium/
$ mvn clean install
$ mkdir build
$ mv ./atomium-*/target/atomium-*-*.jar ./build

You can find the artifacts inside the build/ folder.

Use Maven dependency system inside your project

You need first to clone the Git repository and install the artifacts :

$ git clone https://github.com/Blackrush/Atomium.git
$ cd Atomium/
$ mvn clean install

Then add the dependencies into your pom.xml :

<dependencies>
  <dependency>
    <groupId>org.atomium</groupId>
    <artifactId>atomium-core</artifactId>
    <version>INSERT LAST VERSION HERE</version>
  </dependency>
  <dependency>
    <groupId>org.atomium</groupId>
    <artifactId>atomium-jdbc</artifactId>
    <version>INSERT LAST VERSION HERE</version>
  </dependency>
</dependencies>

This method is temporary, I will as soon as I can deploy the artifacts on Maven Central Repository and you will just have to add the dependencies without clone the repository anymore.

Use Atomium inside your project

Atomium is divided in two parts : the metadata and the database. The metadata part simply holds data of entities and extracts or exports data to the database. The database part handles database's connection and the way the data has to be sent to the database.

Here is a example that uses JDBC drivers :

// the metadata part
MetadataRegistry registry = new SimpleMetadataRegistry();
registry.register(MyEntity.class);

// the database part
Class.forName(driverName);
try (DatabaseInterface database = JdbcDatabase.of("jdbc:url", "user", "password", registry)) {
    try (SessionInterface session = database.createSession()) {
        MyEntity instance = session.findOne(MyEntity.class, 1);
        instance.setAttr("Hello World");
        
        session.persist(instance);
    }
}

Actually, DatabaseInterface simply holds infos to create a connection to the database while SessionInterface is truly the connection to the database and contains all CRUD operations. Furthermore, SessionInterface is responsible of data's cache.

Atomium uses CQEngine to keep the data in memory and retrieve them very efficiently. The way it has been implemented makes it at least 10 times more faster than a naive implementation (more informations on CQEngine wiki).

Integration with Guice

From Guice homepage : Put simply, Guice alleviates the need for factories and the use of new in your Java code. Think of Guice's @Inject as the new new. You will still need to write factories in some cases, but your code will not depend directly on them. Your code will be easier to change, unit test and reuse in other contexts.

todo

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.