orm

Orm configuration using java config

Лицензия

Лицензия

Категории

Категории

ORM Данные
Группа

Группа

com.github.jetqin
Идентификатор

Идентификатор

orm
Последняя версия

Последняя версия

1.1.7
Дата

Дата

Тип

Тип

jar
Описание

Описание

orm
Orm configuration using java config
Ссылка на сайт

Ссылка на сайт

https://github.com/JetQin/orm_configuration
Система контроля версий

Система контроля версий

https://github.com/JetQin/orm_configuration.git

Скачать orm

Имя Файла Размер
orm-1.1.7.pom
orm-1.1.7.jar 13 KB
orm-1.1.7-sources.jar 7 KB
orm-1.1.7-javadoc.jar 68 KB
Обзор

Как подключить последнюю версию

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

Зависимости

compile (8)

Идентификатор библиотеки Тип Версия
org.springframework : spring-orm jar 4.2.1.RELEASE
org.springframework : spring-context-support jar 4.2.1.RELEASE
org.apache.commons : commons-dbcp2 jar 2.0
net.sf.ehcache : ehcache-core jar 2.6.11
org.hibernate : hibernate-core jar 4.3.11.Final
org.hibernate : hibernate-entitymanager jar 4.3.11.Final
org.hibernate : hibernate-ehcache jar 4.3.11.Final
org.projectlombok : lombok jar 1.16.6

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 3.8.1

Модули Проекта

Данный проект не имеет модулей.

@EnableOrmConfiguration

implement hibernate config use java config annotation

Parameters:

#####display sql or not

showSql: boolean default value false;

#####which package to scan

packageToScan:String[] default value new String[]{};

#####which way to implementation,Hibernate or JPA

OrmType: enum default value OrmType.Hibernate; OrmType.Hibernate (Hibernate implementation) OrmType.Jpa (JPA implementation)

How to use

a simple example

  • Create a property file to setup database parameter and hibernate parameter

     connection.driver_class = oracle.jdbc.OracleDriver
     connection.url = jdbc:oracle:thin:@localhost:1521:XE
     connection.username = rdm
     connection.password = 123456
     hibernate.dialect = org.hibernate.dialect.Oracle9iDialect
     
     hibernate.dbcp.initialSize = 10
     hibernate.dbcp.maxActive = 100
     hibernate.dbcp.maxIdle = 10
     hibernate.dbcp.minIdle = 10
    
  • Add @EnableOrmConfiguration at the main configuration file

     @EnableOrmConfiguration(packageToScan="com.example.domain",showSql=false,enableCache=true)
    
    
  • Add package "com.github.jetqin.configuration*" to componentScan parameter

     @ComponentScan(basePackages={"com.example.*","com.github.jetqin.configuration*"})
     
    
Below is an example configuration
@Configuration
@ComponentScan(basePackages={"com.example.*","com.github.jetqin.configuration*"})
@EnableOrmConfiguration(showSql=false,packageToScan="com.example.domain",enableCache=true)
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

Configuration Properties

connection.driver_class = oracle.jdbc.OracleDriver
connection.url = jdbc:oracle:thin:@localhost:1521:ORCL
connection.username = username
connection.password = password
hibernate.dialect = org.hibernate.dialect.Oracle9iDialect

hibernate.dbcp.initialSize = 10
hibernate.dbcp.maxActive = 100
hibernate.dbcp.maxIdle = 10
hibernate.dbcp.minIdle = 10

Maven dependency


<dependency>
		<groupId>com.github.jetqin</groupId>
		<artifactId>orm</artifactId>
		<version>1.1.5</version>
</dependency>

Reference Spring enable annotation

Версии библиотеки

Версия
1.1.7
1.1.5
1.1.2
1.0.20
1.0.19