Brahma Hibernate Utils

An annotaion processor to keep track of @Entity classes

License

License

Categories

Categories

Hibernate Data ORM
GroupId

GroupId

com.gozefo.brahma
ArtifactId

ArtifactId

brahma-hibernateutils
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

Brahma Hibernate Utils
An annotaion processor to keep track of @Entity classes
Project URL

Project URL

https://github.com/gozefo/brahma-hibernateutils
Source Code Management

Source Code Management

http://github.com/gozefo/brahma-hibernateutils/tree/master

Download brahma-hibernateutils

How to add to project

<!-- https://jarcasting.com/artifacts/com.gozefo.brahma/brahma-hibernateutils/ -->
<dependency>
    <groupId>com.gozefo.brahma</groupId>
    <artifactId>brahma-hibernateutils</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.gozefo.brahma/brahma-hibernateutils/
implementation 'com.gozefo.brahma:brahma-hibernateutils:1.0.1'
// https://jarcasting.com/artifacts/com.gozefo.brahma/brahma-hibernateutils/
implementation ("com.gozefo.brahma:brahma-hibernateutils:1.0.1")
'com.gozefo.brahma:brahma-hibernateutils:jar:1.0.1'
<dependency org="com.gozefo.brahma" name="brahma-hibernateutils" rev="1.0.1">
  <artifact name="brahma-hibernateutils" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.gozefo.brahma', module='brahma-hibernateutils', version='1.0.1')
)
libraryDependencies += "com.gozefo.brahma" % "brahma-hibernateutils" % "1.0.1"
[com.gozefo.brahma/brahma-hibernateutils "1.0.1"]

Dependencies

compile (2)

Group / Artifact Type Version
com.squareup : javapoet jar 1.9.0
javax.persistence : persistence-api jar 1.0.2

provided (1)

Group / Artifact Type Version
com.google.auto.service : auto-service jar 1.0-rc4

test (2)

Group / Artifact Type Version
com.google.testing.compile : compile-testing jar 0.15
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

CircleCI Maven metadata URI codecov

Bramha-HibernateUtils

An annotation processor which auto generates a list of all classes with @Entity annotation.

About

Simplify registration of entity classes in Dropwizard by auto generating a list of classes with @Entity annotation.

Example

Here's two entity classes that need to be registered.

package com.example.hibernateutils

import javax.persistence.Entity;

@Entity 
public class Vishnu {
    
}
package com.example.hibernateutils

import javax.persistence.Entity;

@Entity 
public class Shiva {
    
}

Adding entity classes to hibernate bundle is as simple as passing the generated array

 private final HibernateBundle<Config> hibernateBundle =
            new HibernateBundle<Config>(Brahma_HibernateUtils.entityAnnotatedClasses[0],
                    Brahma_HibernateUtils.entityAnnotatedClasses) {

                public DataSourceFactory getDataSourceFactory(Config configuration) {
                    return configuration.getDataSourceFactory();
                }
            };

Generated Code

package com.brahma.utils;

import com.example.HelloWorld;
import java.lang.Class;

public final class Brahma_HibernateUtils {
  public static final Class[] entityAnnotatedClasses = new Class[] {
    Vishnu.class,
    Shiva.class
  }
  ;
}

Project Brahma

This repo is a part of project brahma, a suite of annotation processors built with ♥️ by folks at Gozefo enginnering to remove boilerplate in our java projects.

Download

<!-- https://mvnrepository.com/artifact/com.gozefo.brahma/brahma-hibernateutils -->
<dependency>
    <groupId>com.gozefo.brahma</groupId>
    <artifactId>brahma-hibernateutils</artifactId>
    <version>1.0.1</version>
</dependency>

License

MIT License

Copyright (c) 2018 gozefo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Versions

Version
1.0.1