HIT - A Hibernate quickstart library

Hibernate Induction Trigger - A Hibernate quickstart library

Лицензия

Лицензия

Группа

Группа

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

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

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

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

1.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

HIT - A Hibernate quickstart library
Hibernate Induction Trigger - A Hibernate quickstart library
Система контроля версий

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

https://github.com/mrstampy/hitman.git

Скачать hit

Имя Файла Размер
hit-1.2.pom
hit-1.2.jar 28 KB
hit-1.2-sources.jar 28 KB
hit-1.2-javadoc.jar 119 KB
hit-1.2-config.zip 2 KB
Обзор

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

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

Зависимости

compile (40)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api Необязательный jar 1.7.5
org.slf4j : jcl-over-slf4j Необязательный jar 1.7.5
org.slf4j : log4j-over-slf4j Необязательный jar 1.7.5
org.slf4j : jul-to-slf4j Необязательный jar 1.7.5
ch.qos.logback : logback-classic Необязательный jar 1.0.13
ch.qos.logback : logback-core Необязательный jar 1.0.13
org.hibernate : hibernate-core Необязательный jar 4.2.8.Final
org.hibernate : hibernate-entitymanager Необязательный jar 4.2.8.Final
org.hibernate.common : hibernate-commons-annotations Необязательный jar 4.0.2.Final
org.hibernate.javax.persistence : hibernate-jpa-2.0-api Необязательный jar 1.0.1.Final
org.hibernate : hibernate-ehcache Необязательный jar 4.2.8.Final
net.sf.ehcache : ehcache Необязательный jar 2.8.0
org.apache.commons : commons-lang3 Необязательный jar 3.2.1
org.apache.tomcat : tomcat-jdbc Необязательный jar 7.0.50
c3p0 : c3p0 Необязательный jar 0.9.1.2
com.jolbox : bonecp Необязательный jar 0.8.0.RELEASE
org.vibur : vibur-dbcp Необязательный jar 1.0.0
org.vibur : vibur-object-pool Необязательный jar 1.0.0
com.googlecode.concurrentlinkedhashmap : concurrentlinkedhashmap-lru Необязательный jar 1.3.2
org.springframework : spring-core Необязательный jar 4.0.2.RELEASE
org.springframework : spring-orm Необязательный jar 4.0.2.RELEASE
org.springframework : spring-beans Необязательный jar 4.0.2.RELEASE
org.springframework : spring-context Необязательный jar 4.0.2.RELEASE
org.springframework : spring-jdbc Необязательный jar 4.0.2.RELEASE
org.springframework : spring-aop Необязательный jar 4.0.2.RELEASE
org.springframework : spring-aspects Необязательный jar 4.0.2.RELEASE
org.springframework : spring-tx Необязательный jar 4.0.2.RELEASE
org.springframework : spring-expression Необязательный jar 4.0.2.RELEASE
org.springframework : spring-test Необязательный jar 4.0.2.RELEASE
aopalliance : aopalliance Необязательный jar 1.0
org.aspectj : aspectjweaver Необязательный jar 1.7.4
org.aspectj : aspectjrt Необязательный jar 1.7.4
org.jvnet.opendmk : jmxremote_optional Необязательный jar 1.0_01-ea
org.apache.derby : derby Необязательный jar 10.10.1.1
cglib : cglib-nodep Необязательный jar 3.1
dom4j : dom4j Необязательный jar 1.6.1
org.jboss.logging : jboss-logging Необязательный jar 3.1.0.GA
org.jboss.spec.javax.transaction : jboss-transaction-api_1.1_spec Необязательный jar 1.0.1.Final
antlr : antlr Необязательный jar 2.7.7
org.javassist : javassist Необязательный jar 3.18.1-GA

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

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

HIT: A Hibernate quickstart

HIT - Hibernate Induction Trigger - is a library intended to provide all the configuration and dependencies necessary to begin implementing a stand-alone database-backed Spring/Hibernate application, enabling logging, JMX control, transactional boundaries and second level caching. The example code demonstrates the use of the library; a prototype Spring/Hibernate application can be developed in minutes. A Java 6 runtime (minimum) is required.

HIT on G+

Version 1.2 - released 14/03/14

  • Example code now using an embedded Derby database requiring no database setup by the user.

Version 1.1 - released 5/03/14

  • Data source connection pools are now specified by the first few characters of the AbstractDataSourceCreator implementation. Custom creators can easily be added.
  • AbstractDao now defines byIdRef vs. byId - the former lazy loads the non-key properties while the latter loads all entity properties.

Usage

The steps involved to create a HIT-based application are as follows:

  1. Choose your database vendor, database driver, database name, user etc. and create a blank database

  2. Obtain the HIT library and its dependencies via Ivy, Maven or Gradle (TBA, the artifacts will be available shortly)

  • Ivy - sample Ivy file
  • Maven:
    <dependency>
      <groupId>com.github.mrstampy</groupId>
      <artifactId>hit</artifactId>
      <version>1.2</version>
    </dependency>
  1. Create a Hibernate entity
  1. Create a subclass of AbstractDao for the entity
  1. Create a subclass of AbstractSpringInitializer and any Spring configuration classes necessary
  1. Edit the configuration files and run the application.

Configuration

Four configuration files are necessary to use HIT and must be available on the classpath:

https://github.com/mrstampy/hitman/tree/master/hitman/config https://github.com/mrstampy/hitman/tree/master/hitman/example.config

  1. hit.properties - defines hit-specific properties and can be appended to to add application specific properties.

  2. hibernate.properties - defines Hibernate-specific properties

  3. ehcache.xml - configuration for EhCache second level caching

  4. logback.xml - configuration for logging

DataSource

Included in the distribution are four implementations of a DataSource JDBC connection pool:

To switch between the four change the value of the property 'data.source.creator.type' in hit.properties. Once a connection pool has been chosen for your application the other CP jar dependencies can be excluded from the application build.

*Tomcat JDBC uses the JULI logging framework. There is no official juli-over-slf4j jar file, however adding the classes from https://github.com/pellcorp/juli-over-slf4j to your application will enable logging for this connection pool.

DataSource Configuration

For simple, low to medium volume data access typically 6 properties are of importance when configuring a datasource:

  1. The JDBC driver class
  2. The JDBC URL to the database
  3. The username for the database
  4. The password for the database
  5. The maximum number of connections the datasource can pool
  6. The minimum number of connections in the pool when idle

As each datasource implementation varies in its configuration API, the value of these properties are set via the values in 'hibernate.properties' (the first four) and 'hit.properties' (the last two). Should greater configuration control be required a datasource-specific properties file can be made available on the classpath and specified by the 'datasource.property.file' property in 'hit.properties', with the exception of the first four properties which are always set from 'hibernate.properties' values.

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

Версия
1.2
1.1
1.0