Skip to content

Commit

Permalink
Migrate 5.1 docs in 5.0 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
vladmihalcea committed Apr 4, 2016
1 parent 419ae32 commit 034abc9
Show file tree
Hide file tree
Showing 435 changed files with 44,635 additions and 12 deletions.
1 change: 1 addition & 0 deletions build.gradle
@@ -1,6 +1,7 @@
apply plugin: 'eclipse'
apply plugin: 'idea'
apply from: "./libraries.gradle"
apply from: "./databases.gradle"


buildscript {
Expand Down
48 changes: 48 additions & 0 deletions databases.gradle
@@ -0,0 +1,48 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/

// build a map of the database settings to use.
ext {
db = 'h2'
dbBundle = [
h2 : [
'db.dialect' : 'org.hibernate.dialect.H2Dialect',
'jdbc.driver': 'org.h2.Driver',
'jdbc.user' : 'sa',
'jdbc.pass' : '',
'jdbc.url' : 'jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000',
],
hsqldb : [
'db.dialect' : 'org.hibernate.dialect.HSQLDialect',
'jdbc.driver': 'org.hsqldb.jdbc.JDBCDriver',
'jdbc.user' : 'sa',
'jdbc.pass' : '',
'jdbc.url' : 'jdbc:hsqldb:mem:test'
],
pgsql : [
'db.dialect' : 'org.hibernate.dialect.PostgreSQL94Dialect',
'jdbc.driver': 'org.postgresql.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:postgresql:hibernate_orm_test'
],
mysql : [
'db.dialect' : 'org.hibernate.dialect.MySQL57InnoDBDialect',
'jdbc.driver': 'com.mysql.jdbc.Driver',
'jdbc.user' : 'hibernateormtest',
'jdbc.pass' : 'hibernateormtest',
'jdbc.url' : 'jdbc:mysql://localhost/hibernate_orm_test'
],
mariadb : [
'db.dialect' : 'org.hibernate.dialect.MySQL57InnoDBDialect',
'jdbc.driver': 'org.mariadb.jdbc.Driver',
'jdbc.user' : 'hibernate_orm_test',
'jdbc.pass' : 'hibernate_orm_test',
'jdbc.url' : 'jdbc:mariadb://localhost/hibernate_orm_test'
]
]
}
129 changes: 117 additions & 12 deletions documentation/documentation.gradle
@@ -1,3 +1,4 @@
import org.apache.tools.ant.filters.ReplaceTokens
import org.asciidoctor.gradle.AsciidoctorTask

/*
Expand Down Expand Up @@ -27,6 +28,8 @@ apply plugin: "java"
apply plugin: "jdocbook"
apply plugin: 'org.asciidoctor.convert'

apply plugin: 'hibernate-matrix-testing'

apply from: "${rootProject.projectDir}/utilities.gradle"

defaultTasks 'buildDocs'
Expand All @@ -45,25 +48,66 @@ if ( JavaVersion.current().isJava8Compatible() ) {
}

dependencies {
ext.pressgangVersion = '3.0.0'
ext.pressgangVersion = '3.0.0'

// asciidoctor 'org.asciidoctor:asciidoctorj:1.5.2'
asciidoclet 'org.asciidoctor:asciidoclet:0.+'

jdocbookXsl "org.jboss.pressgang:pressgang-xslt-ns:${pressgangVersion}"
jdocbookXsl "org.jboss.pressgang:pressgang-fonts:${pressgangVersion}"
jdocbookStyles "org.jboss.pressgang:pressgang-jdocbook-style:${pressgangVersion}"

compile( libraries.jpa )
compile( project( ':hibernate-jpamodelgen' ) )

testCompile( 'org.apache.commons:commons-lang3:3.4' )

// asciidoctor 'org.asciidoctor:asciidoctorj:1.5.2'
asciidoclet 'org.asciidoctor:asciidoclet:0.+'
testCompile( project(':hibernate-core') )
testCompile( project(':hibernate-entitymanager') )
testCompile( project(':hibernate-ehcache') )
testCompile( project(':hibernate-spatial') )

jdocbookXsl "org.jboss.pressgang:pressgang-xslt-ns:${pressgangVersion}"
jdocbookXsl "org.jboss.pressgang:pressgang-fonts:${pressgangVersion}"
jdocbookStyles "org.jboss.pressgang:pressgang-jdocbook-style:${pressgangVersion}"
testCompile( project(':hibernate-testing') )
testCompile( project(path: ':hibernate-entitymanager', configuration: 'tests') )

testRuntime( libraries.h2 )
testRuntime( libraries.hsqldb )
}

processTestResources.doLast( {
copy {
from( sourceSets.test.java.srcDirs ) {
include '**/*.properties'
include '**/*.xml'
}
into sourceSets.test.output.classesDir
}
copy {
ext.targetDir = file( "${buildDir}/resources/test" )
from file('src/test/resources')
into targetDir
filter( ReplaceTokens, tokens: dbBundle[db] );
}
} )

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// grouping tasks - declaration, see below for task dependency definitions
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

task buildDocs {
group 'Documentation'
description 'Grouping task for performing all documentation building tasks'
}

task buildDocsForPublishing {
group 'Documentation'
description 'Grouping task for building all documentation for publishing (release)'
}


// aggregated JavaDoc ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// aggregated JavaDoc
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

final File javadocDir = mkdir( new File( (File) project.buildDir, 'javadocs' ) );

Expand Down Expand Up @@ -148,8 +192,6 @@ task aggregateJavadocs(type: Javadoc) {
}
}

buildDocs.dependsOn aggregateJavadocs


// jDocBook ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -215,8 +257,6 @@ task renderTopicalGuides(type: AsciidoctorTask, group: 'Documentation') {
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify'
}

buildDocs.dependsOn renderTopicalGuides



// Getting Started Guides (quick starts) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -231,7 +271,6 @@ task renderGettingStartedGuides(type: AsciidoctorTask, group: 'Documentation') {
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify'
}

buildDocs.dependsOn renderGettingStartedGuides

task buildTutorialZip(type: Zip) {
from 'src/main/asciidoc/quickstart/tutorials'
Expand All @@ -247,3 +286,69 @@ task buildTutorialZip(type: Zip) {

renderGettingStartedGuides.dependsOn buildTutorialZip



// Mapping Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

task renderMappingGuide(type: AsciidoctorTask, group: 'Documentation') {
description = 'Renders the Mapping Guides in HTML format using Asciidoctor.'
sourceDir = file( 'src/main/asciidoc/mapping' )
outputDir = new File("$buildDir/asciidoc/mapping/html")
backends "html5"
separateOutputDirs false
options logDocuments: true
//attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css"
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true
resources {
from('src/main/asciidoc/') {
include 'images/**'
include 'css/**'
}
}
}

// User Guides ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

final String[] versionComponents = version.split( '\\.' );
final String majorMinorVersion = versionComponents[0] + '.' + versionComponents[1];

task renderUserGuide(type: AsciidoctorTask, group: 'Documentation') {
description = 'Renders the User Guides in HTML format using Asciidoctor.'
sourceDir = file( 'src/main/asciidoc/userguide' )
outputDir = new File("$buildDir/asciidoc/userguide/html_single")
backends "html5"
separateOutputDirs false
options logDocuments: true
attributes icons: 'font', experimental: true, 'source-highlighter': 'prettify', linkcss: true, stylesheet: "css/hibernate.css", majorMinorVersion: majorMinorVersion
resources {
from('src/main/asciidoc/userguide/') {
include 'images/**'
}
from('src/main/style/asciidoctor') {
include 'images/**'
}
from('src/main/style/asciidoctor') {
include 'css/**'
}
}
}


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// grouping tasks
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

buildDocs.dependsOn aggregateJavadocs
buildDocs.dependsOn renderTopicalGuides
buildDocs.dependsOn renderGettingStartedGuides
buildDocs.dependsOn renderUserGuide
// the jDocBook plugin already adds its main task as a dependency of the buildDocs task


buildDocsForPublishing.dependsOn aggregateJavadocs
buildDocsForPublishing.dependsOn renderTopicalGuides
buildDocsForPublishing.dependsOn renderGettingStartedGuides
buildDocsForPublishing.dependsOn renderUserGuide
// only html-single to match what Asciidoctor currently offers
//buildDocsForPublishing.dependsOn 'renderDocBook_integrationsGuide_en-US_html_single '
buildDocsForPublishing.dependsOn renderDocBook_integrationsGuide
6 changes: 6 additions & 0 deletions documentation/src/main/asciidoc/userguide/Bibliography.adoc
@@ -0,0 +1,6 @@
== References

[bibliography]
- [[[PoEAA]]] Martin Fowler. Patterns of Enterprise Application Architecture.
Addison-Wesley Publishing Company. 2003.
- [[[JPwH]]] Christian Bauer & Gavin King. http://www.manning.com/bauer2[Java Persistence with Hibernate]. Manning Publications Co. 2007.
@@ -0,0 +1,39 @@
= Hibernate ORM {majorMinorVersion} User Guide
Steve Ebersole, Vlad Mihalcea, Andrea Boriero, Brett Meyer, Radim Vansa
:toc:
:toclevels: 3

include::Preface.adoc[]

:numbered:

include::chapters/architecture/Architecture.adoc[]
include::chapters/domain/DomainModel.adoc[]
include::chapters/bootstrap/Bootstrap.adoc[]
include::chapters/pc/PersistenceContext.adoc[]
include::chapters/flushing/Flushing.adoc[]
include::chapters/jdbc/Database_Access.adoc[]
include::chapters/transactions/Transactions.adoc[]
include::chapters/jndi/JNDI.adoc[]
include::chapters/locking/Locking.adoc[]
include::chapters/fetching/Fetching.adoc[]
include::chapters/batch/Batching.adoc[]
include::chapters/caching/Caching.adoc[]
include::chapters/events/Events.adoc[]
include::chapters/query/hql/HQL.adoc[]
include::chapters/query/criteria/Criteria.adoc[]
include::chapters/query/native/Native.adoc[]
include::chapters/query/spatial/Spatial.adoc[]
include::chapters/multitenancy/MultiTenancy.adoc[]
include::chapters/osgi/OSGi.adoc[]
include::chapters/envers/Envers.adoc[]
include::chapters/portability/Portability.adoc[]

include::appendices/Configurations.adoc[]
include::appendices/Legacy_Bootstrap.adoc[]
include::appendices/Legacy_DomainModel.adoc[]
include::appendices/Legacy_Criteria.adoc[]
include::appendices/Legacy_Native_Queries.adoc[]

include::Bibliography.adoc[]

60 changes: 60 additions & 0 deletions documentation/src/main/asciidoc/userguide/Preface.adoc
@@ -0,0 +1,60 @@
[[preface]]
== Preface

Developing Object-Oriented software that deals with data from Relational
Databases can be cumbersome and resource consuming. Development costs
are significantly higher due to a paradigm mismatch between how data is
represented in objects versus relational databases. Hibernate is an
Object/Relational Mapping (ORM) solution for Java environments. ORM
refers to the technique of mapping data between an object model
representation to a relational data model representation. See
http://en.wikipedia.org/wiki/Object-relational_mapping[Wikipedia] for a
good high-level discussion. Also, Martin Fowler's
http://martinfowler.com/bliki/OrmHate.html[OrmHate] article takes a look
at many of the mentioned mismatch problems.

Although having a strong background in SQL is not required to use
Hibernate, having a basic understanding of the concepts can help you
understand Hibernate more quickly and fully. An understanding of data
modeling principles is especially important. Both
http://www.agiledata.org/essays/dataModeling101.html and
http://en.wikipedia.org/wiki/Data_modeling are good starting points for
understanding these data modeling principles.

Understanding the basics of transactions and design patterns such as
"Unit of Work" <<Bibliography.adoc#PoEAA,PoEAA>> or "ApplicationTransaction" are important as well.
These topics will be discussed in the documentation, but a prior
understanding will certainly help.

Hibernate not only takes care of the mapping from Java classes to
database tables (and from Java data types to SQL data types), but also
provides data query and retrieval facilities. It can significantly
reduce development time otherwise spent with manual data handling in SQL
and JDBC. Hibernate’s design goal is to relieve the developer from 95%
of common data persistence-related programming tasks by eliminating the
need for manual, hand-crafted data processing using SQL and JDBC.
However, unlike many other persistence solutions, Hibernate does not
hide the power of SQL from you and guarantees that your investment in
relational technology and knowledge is as valid as always.

Hibernate may not be the best solution for data-centric applications
that only use stored procedures to implement the business logic in the
database, it is most useful with object-oriented domain models and
business logic in the Java-based middle-tier. However, Hibernate can
certainly help you to remove or encapsulate vendor-specific SQL code and
will help with the common task of result set translation from a tabular
representation to a graph of objects.

See http://hibernate.org/orm/contribute/ for information on getting
involved.


[TIP]
====
If you are just getting started with using Hibernate you may want to
start with the Hibernate Getting Started Guide available from the
http://hibernate.org/orm/documentation[documentation page]. It contains
quick-start style tutorials as well as lots of introductory information.
There is also a series of topical guides providing deep dives into
various topics.
====

0 comments on commit 034abc9

Please sign in to comment.