HHH-7067 - Update build to work with Gradle m8
148
build.gradle
|
@ -5,8 +5,8 @@ allprojects {
|
|||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
mavenRepo name: 'jboss-nexus', urls: "https://repository.jboss.org/nexus/content/groups/public/"
|
||||
mavenRepo name: "jboss-snapshots", urls: "http://snapshots.jboss.org/maven2/"
|
||||
mavenRepo name: 'jboss-nexus', url: "https://repository.jboss.org/nexus/content/groups/public/"
|
||||
mavenRepo name: "jboss-snapshots", url: "http://snapshots.jboss.org/maven2/"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,34 +14,55 @@ buildscript {
|
|||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
mavenRepo name: 'jboss-nexus', urls: "https://repository.jboss.org/nexus/content/groups/public/"
|
||||
mavenRepo name: "jboss-snapshots", urls: "http://snapshots.jboss.org/maven2/"
|
||||
mavenRepo name: 'jboss-nexus', url: "https://repository.jboss.org/nexus/content/groups/public/"
|
||||
mavenRepo name: "jboss-snapshots", url: "http://snapshots.jboss.org/maven2/"
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.hibernate.build.gradle:gradle-upload-auth-plugin:1.0.2'
|
||||
classpath 'org.hibernate.build.gradle:gradle-upload-auth-plugin:1.1.0'
|
||||
}
|
||||
}
|
||||
|
||||
ideaProject {
|
||||
javaVersion = "1.6"
|
||||
withXml { provider ->
|
||||
def node = provider.asNode()
|
||||
def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' }
|
||||
vcsConfig.mapping[0].'@vcs' = 'Git'
|
||||
def maxHeapSizeConfig = node.component.find { it.'@name' == 'JavacSettings' }
|
||||
if( maxHeapSizeConfig == null ){
|
||||
def javacSettingsNode = node.appendNode('component',[name: 'JavacSettings'])
|
||||
javacSettingsNode.appendNode('option', [name:"MAXIMUM_HEAP_SIZE", value:"512"])
|
||||
}
|
||||
}
|
||||
beforeConfigured { module ->
|
||||
module.modulePaths.removeAll { it.filePath.endsWith('hibernate-core.iml') }
|
||||
}
|
||||
}
|
||||
|
||||
ideaModule {
|
||||
moduleName = 'hibernate-core-root'
|
||||
idea {
|
||||
project {
|
||||
jdkName = "1.6"
|
||||
ipr {
|
||||
withXml { provider ->
|
||||
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
|
||||
def maxHeapSizeConfig = provider.node.component.find { it.@name == 'JavacSettings' }
|
||||
if( maxHeapSizeConfig == null ){
|
||||
def javacSettingsNode = provider.node.appendNode('component',[name: 'JavacSettings'])
|
||||
javacSettingsNode.appendNode('option', [name:"MAXIMUM_HEAP_SIZE", value:"512"])
|
||||
}
|
||||
}
|
||||
beforeMerged { project ->
|
||||
project.modulePaths.clear()
|
||||
}
|
||||
}
|
||||
}
|
||||
module {
|
||||
name = "hibernate-orm"
|
||||
}
|
||||
}
|
||||
//ideaProject {
|
||||
// javaVersion = "1.6"
|
||||
// withXml { provider ->
|
||||
// def node = provider.asNode()
|
||||
// def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' }
|
||||
// vcsConfig.mapping[0].'@vcs' = 'Git'
|
||||
// def maxHeapSizeConfig = node.component.find { it.'@name' == 'JavacSettings' }
|
||||
// if( maxHeapSizeConfig == null ){
|
||||
// def javacSettingsNode = node.appendNode('component',[name: 'JavacSettings'])
|
||||
// javacSettingsNode.appendNode('option', [name:"MAXIMUM_HEAP_SIZE", value:"512"])
|
||||
// }
|
||||
// }
|
||||
// beforeConfigured { module ->
|
||||
// module.modulePaths.removeAll { it.filePath.endsWith('hibernate-core.iml') }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//ideaModule {
|
||||
// moduleName = 'hibernate-core-root'
|
||||
//}
|
||||
|
||||
// build a map of the dependency artifacts to use. Allows centralized definition of the version of artifacts to
|
||||
// use. In that respect it serves a role similar to <dependencyManagement> in Maven
|
||||
|
@ -227,30 +248,62 @@ subprojects { subProject ->
|
|||
targetCompatibility = "1.6"
|
||||
sourceCompatibility = "1.6"
|
||||
|
||||
ideaModule {
|
||||
beforeConfigured { module ->
|
||||
module.excludeFolders.clear()
|
||||
}
|
||||
scopes.COMPILE.plus.add( configurations.provided )
|
||||
whenConfigured { module ->
|
||||
module.dependencies*.exported = true
|
||||
}
|
||||
excludeDirs = [
|
||||
file(".gradle"),
|
||||
file("$buildDir/classes"),
|
||||
file("$buildDir/dependency-cache"),
|
||||
file("$buildDir/libs"),
|
||||
file("$buildDir/reports"),
|
||||
file("$buildDir/test-results"),
|
||||
file("$buildDir/tmp"),
|
||||
file("$buildDir/matrix")
|
||||
] as Set
|
||||
}
|
||||
|
||||
eclipseClasspath {
|
||||
plusConfigurations.add( configurations.provided )
|
||||
idea {
|
||||
module {
|
||||
iml {
|
||||
beforeMerged { module ->
|
||||
module.dependencies.clear()
|
||||
module.excludeFolders.clear()
|
||||
}
|
||||
whenMerged { module ->
|
||||
module.dependencies*.exported = true
|
||||
module.excludeFolders = [
|
||||
file(".gradle"),
|
||||
file("$buildDir/bundles"),
|
||||
file("$buildDir/classes"),
|
||||
file("$buildDir/dependency-cache"),
|
||||
file("$buildDir/libs"),
|
||||
file("$buildDir/reports"),
|
||||
file("$buildDir/test-results"),
|
||||
file("$buildDir/tmp"),
|
||||
file("$buildDir/matrix")
|
||||
] as Set
|
||||
}
|
||||
}
|
||||
downloadSources = true
|
||||
scopes.COMPILE.plus += configurations.provided
|
||||
}
|
||||
}
|
||||
|
||||
// ideaModule {
|
||||
// beforeConfigured { module ->
|
||||
// module.excludeFolders.clear()
|
||||
// }
|
||||
// scopes.COMPILE.plus.add( configurations.provided )
|
||||
// whenConfigured { module ->
|
||||
// module.dependencies*.exported = true
|
||||
// }
|
||||
// excludeDirs = [
|
||||
// file(".gradle"),
|
||||
// file("$buildDir/classes"),
|
||||
// file("$buildDir/dependency-cache"),
|
||||
// file("$buildDir/libs"),
|
||||
// file("$buildDir/reports"),
|
||||
// file("$buildDir/test-results"),
|
||||
// file("$buildDir/tmp"),
|
||||
// file("$buildDir/matrix")
|
||||
// ] as Set
|
||||
// }
|
||||
|
||||
eclipse {
|
||||
classpath {
|
||||
plusConfigurations.add( configurations.provided )
|
||||
}
|
||||
}
|
||||
// eclipseClasspath {
|
||||
// plusConfigurations.add( configurations.provided )
|
||||
// }
|
||||
|
||||
// elements used to customize the generated POM used during upload
|
||||
def pomConfig = {
|
||||
name 'A Hibernate Core Module'
|
||||
|
@ -326,6 +379,5 @@ dependsOnChildren()
|
|||
// 2) /gradlew.bat which is the windows bat script for for executing builds
|
||||
// 3) /wrapper which is a directory named by the "jarPath" config which contains other needed files.
|
||||
task wrapper(type: Wrapper) {
|
||||
// HHH-6106 - this is needed for IntellJ generation until 1.0-milestone-3 is released.
|
||||
gradleVersion = '1.0-milestone-3'
|
||||
gradleVersion = '1.0-milestone-8'
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ buildDir = "target"
|
|||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
mavenRepo name: "jboss", urls: "http://repository.jboss.org/nexus/content/groups/public/"
|
||||
mavenRepo name: "jboss", url: "http://repository.jboss.org/nexus/content/groups/public/"
|
||||
}
|
||||
targetCompatibility = "1.6"
|
||||
sourceCompatibility = "1.6"
|
||||
|
@ -51,8 +51,10 @@ dependencies {
|
|||
groovy localGroovy()
|
||||
}
|
||||
|
||||
ideaModule {
|
||||
downloadSources =true
|
||||
downloadJavadoc= true
|
||||
javaVersion = '1.6'
|
||||
idea {
|
||||
module {
|
||||
downloadSources = true
|
||||
downloadJavadoc = true
|
||||
javaVersion = '1.6'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@ buildscript {
|
|||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
mavenRepo name: "jboss", urls: "http://repository.jboss.org/nexus/content/groups/public/"
|
||||
mavenRepo name: 'jboss-nexus', url: "https://repository.jboss.org/nexus/content/groups/public/"
|
||||
}
|
||||
dependencies {
|
||||
classpath 'org.jboss.jdocbook:gradle-jdocbook:1.1.0'
|
||||
classpath 'org.jboss.jdocbook:gradle-jdocbook:1.1.3'
|
||||
classpath "org.jboss.pressgang:pressgang-xslt:2.0.1"
|
||||
classpath "org.jboss.pressgang:pressgang-fonts:2.0.1"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +15,10 @@ apply plugin: "java"
|
|||
apply plugin: "jdocbook"
|
||||
|
||||
dependencies {
|
||||
jdocbookStyles "org.hibernate:hibernate-jdocbook-style:2.0.1"
|
||||
jdocbookStyles( "org.jboss.pressgang:pressgang-jdocbook-style:2.0.1" ) {
|
||||
exclude group: 'org.eclipse.wst.css'
|
||||
exclude group: 'org.eclipse.wst.sse'
|
||||
}
|
||||
}
|
||||
|
||||
defaultTasks 'buildDocs'
|
||||
|
@ -49,6 +54,7 @@ jdocbook {
|
|||
// todo : make this part of gradle-jdocbook.
|
||||
// specifically the ability to supply ant-style resource for images (dir + include/exclude patterns)
|
||||
stageStyles_devguide.doLast {
|
||||
logger.lifecycle( "Staging devguide-specific style resources")
|
||||
copy {
|
||||
into project.file( 'target/docbook/stage/devguide/images' )
|
||||
from project.file( 'src/main/docbook/devguide/en-US' )
|
||||
|
@ -58,6 +64,17 @@ stageStyles_devguide.doLast {
|
|||
}
|
||||
}
|
||||
|
||||
[ 'devguide', 'manual', 'quickstart' ].each { bookName ->
|
||||
tasks[ "stageStyles_$bookName" ].doLast {
|
||||
logger.lifecycle( "Staging local style resources")
|
||||
copy {
|
||||
into project.file( "target/docbook/stage/$bookName" )
|
||||
from project.file( 'src/main/style' )
|
||||
includeEmptyDirs = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task buildTutorialZip(type: Zip) {
|
||||
destinationDir = file( "target/work/tutorials" )
|
||||
archiveName = 'hibernate-tutorials.zip'
|
||||
|
|
|
@ -1,81 +1,80 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Gavin</firstname>
|
||||
<surname>King</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Christian</firstname>
|
||||
<surname>Bauer</surname>
|
||||
</author>
|
||||
|
||||
<authorgroup xmlns="http://docbook.org/ns/docbook">
|
||||
<author>
|
||||
<firstname>Steve</firstname>
|
||||
<surname>Ebersole</surname>
|
||||
<personname>
|
||||
<firstname>Gavin</firstname>
|
||||
<surname>King</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Max</firstname>
|
||||
<othername>Rydahl</othername>
|
||||
<surname>Andersen</surname>
|
||||
</author>
|
||||
<personname>
|
||||
<firstname>Christian</firstname>
|
||||
<surname>Bauer</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Emmanuel</firstname>
|
||||
<surname>Bernard</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Hardy</firstname>
|
||||
<surname>Ferentschik</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Adam</firstname>
|
||||
<surname>Warski</surname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Gail</firstname>
|
||||
<surname>Badner</surname>
|
||||
</author>
|
||||
<personname>
|
||||
<firstname>Steve</firstname>
|
||||
<surname>Ebersole</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Max</firstname>
|
||||
<othername>Rydahl</othername>
|
||||
<surname>Andersen</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Emmanuel</firstname>
|
||||
<surname>Bernard</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Hardy</firstname>
|
||||
<surname>Ferentschik</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Adam</firstname>
|
||||
<surname>Warski</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Gail</firstname>
|
||||
<surname>Badner</surname>
|
||||
</personname>
|
||||
</author>
|
||||
|
||||
<othercredit>
|
||||
<firstname>James</firstname>
|
||||
<surname>Cobb</surname>
|
||||
<affiliation>
|
||||
<shortaffil>Graphic Design</shortaffil>
|
||||
</affiliation>
|
||||
</othercredit>
|
||||
<othercredit>
|
||||
<firstname>Cheyenne</firstname>
|
||||
<surname>Weaver</surname>
|
||||
<affiliation>
|
||||
<shortaffil>Graphic Design</shortaffil>
|
||||
</affiliation>
|
||||
</othercredit>
|
||||
<othercredit>
|
||||
<personname>
|
||||
<firstname>James</firstname>
|
||||
<surname>Cobb</surname>
|
||||
</personname>
|
||||
<affiliation>
|
||||
<shortaffil>Graphic Design</shortaffil>
|
||||
</affiliation>
|
||||
</othercredit>
|
||||
<othercredit>
|
||||
<personname>
|
||||
<firstname>Cheyenne</firstname>
|
||||
<surname>Weaver</surname>
|
||||
</personname>
|
||||
<affiliation>
|
||||
<shortaffil>Graphic Design</shortaffil>
|
||||
</affiliation>
|
||||
</othercredit>
|
||||
|
||||
<editor>
|
||||
<firstname>Misty</firstname>
|
||||
<surname>Stanley-Jones</surname>
|
||||
<personname>
|
||||
<firstname>Misty</firstname>
|
||||
<surname>Stanley-Jones</surname>
|
||||
</personname>
|
||||
</editor>
|
||||
|
||||
</authorgroup>
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>Batch Processing</title>
|
||||
<para>
|
||||
The following example shows an antipattern for batch inserts.
|
||||
</para>
|
||||
<example>
|
||||
<title>Naive way to insert 100000 lines with Hibernate</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/batch_insert.java"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/batch_insert.java" parse="text" /></programlisting>
|
||||
<para>
|
||||
This fails with exception <systemitem>OutOfMemoryException</systemitem> after around 50000 rows on most
|
||||
systems. The reason is that Hibernate caches all the newly inserted Customer instances in the session-level
|
||||
|
@ -40,7 +38,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Flushing and clearing the <classname>Session</classname></title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/flush_and_clear_session.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/flush_and_clear_session.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -53,7 +51,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Using <methodname>scroll()</methodname></title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/using_scroll.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/using_scroll.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -113,7 +111,7 @@
|
|||
</itemizedlist>
|
||||
<example>
|
||||
<title>Using a <interfacename>StatelessSession</interfacename></title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/using_a_StatelessSession.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/using_a_StatelessSession.java" parse="text" /></programlisting>
|
||||
<para>
|
||||
The <classname>Customer</classname> instances returned by the query are immediately detached. They are never
|
||||
associated with any persistence context.
|
||||
|
@ -158,7 +156,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Executing an HQL UPDATE, using the <methodname>Query.executeUpdate()</methodname> method</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/executeUpdate.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/executeUpdate.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
In keeping with the EJB3 specification, HQL UPDATE statements, by default, do not effect the version or the
|
||||
|
@ -168,7 +166,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Updating the version of timestamp</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/updating_version.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/updating_version.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -178,7 +176,7 @@
|
|||
</note>
|
||||
<example>
|
||||
<title>A HQL <literal>DELETE</literal> statement</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/hql_delete.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/hql_delete.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Method <methodname>Query.executeUpdate()</methodname> returns an <type>int</type> value, which indicates the
|
||||
|
@ -233,7 +231,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>HQL INSERT statement</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/hql-insert.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/hql-insert.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
<section>
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<bookinfo id="Hibernate_Developer_Guide">
|
||||
<title>Hibernate Developer Guide</title>
|
||||
<releaseinfo>&version;</releaseinfo>
|
||||
<edition>1.0</edition>
|
||||
<pubsnumber>1</pubsnumber>
|
||||
<productname>JBoss Hibernate Core</productname>
|
||||
<productnumber>&version;</productnumber>
|
||||
<pubdate>&today;</pubdate>
|
||||
<issuenum>1</issuenum>
|
||||
<mediaobject>
|
||||
<imageobject role="fo">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" align="center" />
|
||||
</imageobject>
|
||||
<imageobject role="html">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" depth="3cm" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
<copyright>
|
||||
<year>©rightYear;</year>
|
||||
<holder>©rightHolder;</holder>
|
||||
</copyright>
|
||||
|
||||
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
</bookinfo>
|
|
@ -1,11 +1,11 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
<title>Caching</title>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<info>
|
||||
<title>Caching</title>
|
||||
</info>
|
||||
|
||||
<section>
|
||||
<title>The query cache</title>
|
||||
|
@ -74,7 +74,7 @@
|
|||
|
||||
<example>
|
||||
<title>Method <methodname>setCacheRegion</methodname></title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/setCacheRegion.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/setCacheRegion.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -171,7 +171,7 @@
|
|||
</note>
|
||||
<example id="configuring-cache-providers-annotations">
|
||||
<title>Configuring cache providers using annotations</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/cache_providers_mapping.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/cache_providers_mapping.java" parse="text" /></programlisting>
|
||||
<para>
|
||||
You can cache the content of a collection or the identifiers, if the collection contains other entities. Use
|
||||
the <code>@Cache</code> annotation on the Collection property.
|
||||
|
@ -250,8 +250,7 @@
|
|||
|
||||
<example>
|
||||
<title>Configuring cache providers using mapping files</title>
|
||||
<programlisting language="XML" role="XML"><xi:include href="extras/cache_providers.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="XML" role="XML"><xi:include href="extras/cache_providers.xml" parse="text" /></programlisting>
|
||||
<para>
|
||||
Just as in the <xref linkend="configuring-cache-providers-annotations" />, you can provide attributes in the
|
||||
mapping file. There are some specific differences in the syntax for the attributes in a mapping file.
|
||||
|
@ -507,7 +506,7 @@
|
|||
</formalpara>
|
||||
<example>
|
||||
<title>Evicting an item from the first-level cache</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/evicting_item.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/evicting_item.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<formalpara>
|
||||
<title>Determining whether an item belongs to the Session cache</title>
|
||||
|
@ -523,7 +522,7 @@
|
|||
You can evict the cached state of an instance, entire class, collection instance or entire collection role,
|
||||
using methods of <classname>SessionFactory</classname>.
|
||||
</para>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/evicting_from_second_level_cache.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/evicting_from_second_level_cache.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<section>
|
||||
<title>Interactions between a Session and the second-level cache</title>
|
||||
|
@ -573,9 +572,8 @@
|
|||
</step>
|
||||
</procedure>
|
||||
<example>
|
||||
<title>Browsing the second-level cache entries via the Statistics API</title> <programlisting language="Java"
|
||||
role="JAVA"><xi:include href="extras/browsing_cache.java" xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
parse="text" /></programlisting>
|
||||
<title>Browsing the second-level cache entries via the Statistics API</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/browsing_cache.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
</section>
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook">
|
||||
|
||||
<title>Data categorizations</title>
|
||||
<para>
|
||||
Hibernate understands both the Java and JDBC representations of application data. The ability to read and write
|
||||
|
@ -24,11 +22,11 @@
|
|||
</para>
|
||||
</note>
|
||||
<para>
|
||||
Hibernate categorizes types into two high-level groups: <xref linkend="value-types" /> and <xref
|
||||
linkend="entity-types" />.
|
||||
Hibernate categorizes types into two high-level groups: <xref linkend="value-types" />
|
||||
and <xref linkend="entity-types" />.
|
||||
</para>
|
||||
|
||||
<section id="value-types">
|
||||
<section xml:id="value-types">
|
||||
<title>Value types</title>
|
||||
<para>
|
||||
A <firstterm>value type</firstterm> does not define its own lifecycle. It is, in effect, owned by an <xref
|
||||
|
@ -41,7 +39,7 @@
|
|||
<listitem><para><xref linkend="value-collection-types" /></para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<section id="value-basic-types">
|
||||
<section xml:id="value-basic-types">
|
||||
<title>Basic types</title>
|
||||
<para>
|
||||
Basic value types usually map a single database value, or column, to a single, non-aggregated Java
|
||||
|
@ -297,7 +295,7 @@
|
|||
</table>
|
||||
</section>
|
||||
|
||||
<section id="value-composite-types">
|
||||
<section xml:id="value-composite-types">
|
||||
<title>Composite types</title>
|
||||
<para>
|
||||
<firstterm>Composite types</firstterm>, or <firstterm>embedded types</firstterm>, as they are called by the Java
|
||||
|
@ -315,7 +313,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="value-collection-types">
|
||||
<section xml:id="value-collection-types">
|
||||
<title>Collection types</title>
|
||||
<para>
|
||||
A <firstterm>collection</firstterm> type refers to the data type itself, not its contents.
|
||||
|
@ -328,7 +326,7 @@
|
|||
</para>
|
||||
</section>
|
||||
</section>
|
||||
<section id="entity-types">
|
||||
<section xml:id="entity-types">
|
||||
<title>Entity Types</title>
|
||||
<para>
|
||||
Entities are application-specific classes which correlate to rows in a table, using a unique identifier. Because
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>Database access</title>
|
||||
|
||||
<section>
|
||||
|
@ -49,15 +49,11 @@
|
|||
</para>
|
||||
<example>
|
||||
<title><filename>hibernate.properties</filename> for a c3p0 connection pool</title>
|
||||
<programlisting>
|
||||
<xi:include href="extras/hibernate.properties" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" />
|
||||
</programlisting>
|
||||
<programlisting><xi:include href="extras/hibernate.properties" parse="text" /></programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title><filename>hibernate.cfg.xml</filename> for a connection to the bundled HSQL database</title>
|
||||
<programlisting language="XML" role="XML">
|
||||
<xi:include href="extras/hibernate.cfg.xml" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" />
|
||||
</programlisting>
|
||||
<programlisting language="XML" role="XML"><xi:include href="extras/hibernate.cfg.xml" parse="text" /></programlisting>
|
||||
</example>
|
||||
|
||||
<section>
|
||||
|
@ -76,8 +72,7 @@
|
|||
directly and specifying XML mapping documents. If the mapping files are in the classpath, use method
|
||||
<methodname>addResource()</methodname>.
|
||||
</para>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/specify_mapping_files_directly.java"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/specify_mapping_files_directly.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Letting Hibernate find the mapping files for you</title>
|
||||
|
@ -87,11 +82,11 @@
|
|||
<filename>org/hibernate/auction/Item.hbm.xml</filename> and
|
||||
<filename>org/hibernate/auction/Bid.hbm.xml</filename>.
|
||||
</para>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/letting_hibernate_find_mapping_files.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/letting_hibernate_find_mapping_files.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Specifying configuration properties</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/specifying_configuration_properties_programmatically.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/specifying_configuration_properties_programmatically.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<itemizedlist>
|
||||
<title>Other ways to configure Hibernate programmatically</title>
|
||||
|
@ -120,9 +115,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Specifying configuration properties</title>
|
||||
<programlisting language="Java" role="JAVA">
|
||||
<xi:include href="extras/opening_a_session.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" />
|
||||
</programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/opening_a_session.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<itemizedlist id="hibernate-jdbc-properties">
|
||||
<title>Most important Hibernate JDBC properties</title>
|
||||
|
@ -172,8 +165,7 @@
|
|||
<filename>lib/</filename> directory. Hibernate uses its
|
||||
<classname>org.hibernate.service.jdbc.connections.internal.ProxoolConnectionProvider</classname> for connection pooling if you set the
|
||||
<property>hibernate.proxool.*</property> properties. Unlike c3p0, proxool requires some additional configuration
|
||||
parameters, as described by the Proxool documentation available at <ulink
|
||||
url="http://proxool.sourceforge.net/configure.html" />.
|
||||
parameters, as described by the Proxool documentation available at <link xlink:href="http://proxool.sourceforge.net/configure.html" />.
|
||||
</para>
|
||||
<table>
|
||||
<title>Important configuration properties for the Proxool connection pool</title>
|
||||
|
|
|
@ -1,24 +1,20 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<chapter>
|
||||
<title>Envers</title>
|
||||
|
||||
<preface>
|
||||
<title>Preface</title>
|
||||
<para>
|
||||
The aim of Hibernate Envers is to provide historical versioning of your application's entity data. Much
|
||||
like source control management tools such as Subversion or Git, Hibernate Envers manages a notion of revisions
|
||||
if your application data through the use of audit tables. Each transaction relates to one global revision number
|
||||
which can be used to identify groups of changes (much like a change set in source control). As the revisions
|
||||
are global, having a revision number, you can query for various entities at that revision, retrieving a
|
||||
(partial) view of the database at that revision. You can find a revision number having a date, and the other
|
||||
way round, you can get the date at which a revision was committed.
|
||||
</para>
|
||||
</preface>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" >
|
||||
<info>
|
||||
<title>Envers</title>
|
||||
<abstract>
|
||||
<para>
|
||||
The aim of Hibernate Envers is to provide historical versioning of your application's entity data. Much
|
||||
like source control management tools such as Subversion or Git, Hibernate Envers manages a notion of revisions
|
||||
if your application data through the use of audit tables. Each transaction relates to one global revision number
|
||||
which can be used to identify groups of changes (much like a change set in source control). As the revisions
|
||||
are global, having a revision number, you can query for various entities at that revision, retrieving a
|
||||
(partial) view of the database at that revision. You can find a revision number having a date, and the other
|
||||
way round, you can get the date at which a revision was committed.
|
||||
</para>
|
||||
</abstract>
|
||||
</info>
|
||||
|
||||
<section>
|
||||
<title>Basics</title>
|
||||
|
@ -52,7 +48,7 @@
|
|||
|
||||
<para>
|
||||
The audit (history) of an entity can be accessed using the <literal>AuditReader</literal> interface, which
|
||||
can be obtained having an open <listeral>EntityManager</listeral> or <literal>Session</literal> via
|
||||
can be obtained having an open <literal>EntityManager</literal> or <literal>Session</literal> via
|
||||
the <literal>AuditReaderFactory</literal>. See the javadocs for these classes for details on the
|
||||
functionality offered.
|
||||
</para>
|
||||
|
@ -398,7 +394,7 @@
|
|||
</orderedlist>
|
||||
</section>
|
||||
|
||||
<section id="envers-revisionlog">
|
||||
<section xml:id="envers-revisionlog">
|
||||
<title>Revision Log</title>
|
||||
<subtitle>Logging data for revisions</subtitle>
|
||||
|
||||
|
@ -408,14 +404,18 @@
|
|||
</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<firstterm>revision number</firstterm> - An integral value (<literal>int/Integer</literal> or
|
||||
<literal>long/Long</literal>). Essentially the primary key of the revision
|
||||
<para>
|
||||
<firstterm>revision number</firstterm> - An integral value (<literal>int/Integer</literal> or
|
||||
<literal>long/Long</literal>). Essentially the primary key of the revision
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<firstterm>revision timestamp</firstterm> - either a <literal>long/Long</literal> or
|
||||
<classname>java.util.Date</classname> value representing the instant at which the revision was made.
|
||||
When using a <classname>java.util.Date</classname>, instead of a <literal>long/Long</literal> for
|
||||
the revision timestamp, take care not to store it to a column data type which will loose precision.
|
||||
<para>
|
||||
<firstterm>revision timestamp</firstterm> - either a <literal>long/Long</literal> or
|
||||
<classname>java.util.Date</classname> value representing the instant at which the revision was made.
|
||||
When using a <classname>java.util.Date</classname>, instead of a <literal>long/Long</literal> for
|
||||
the revision timestamp, take care not to store it to a column data type which will loose precision.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
|
@ -530,7 +530,7 @@ public class ExampleListener implements RevisionListener {
|
|||
|
||||
</example>
|
||||
|
||||
<section id="envers-tracking-modified-entities-revchanges">
|
||||
<section xml:id="envers-tracking-modified-entities-revchanges">
|
||||
<title>Tracking entity names modified during revisions</title>
|
||||
<para>
|
||||
By default entity types that have been changed in each revision are not being tracked. This implies the
|
||||
|
@ -544,14 +544,18 @@ public class ExampleListener implements RevisionListener {
|
|||
</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
Set <property>org.hibernate.envers.track_entities_changed_in_revision</property> parameter to
|
||||
<literal>true</literal>. In this case
|
||||
<classname>org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity</classname> will
|
||||
be implicitly used as the revision log entity.
|
||||
<para>
|
||||
Set <property>org.hibernate.envers.track_entities_changed_in_revision</property> parameter to
|
||||
<literal>true</literal>. In this case
|
||||
<classname>org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity</classname> will
|
||||
be implicitly used as the revision log entity.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
Create a custom revision entity that extends
|
||||
<classname>org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity</classname> class.
|
||||
<para>
|
||||
Create a custom revision entity that extends
|
||||
<classname>org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity</classname> class.
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[@Entity
|
||||
@RevisionEntity
|
||||
|
@ -561,9 +565,11 @@ public class ExtendedRevisionEntity
|
|||
}]]></programlisting>
|
||||
</listitem>
|
||||
<listitem>
|
||||
Mark an appropriate field of a custom revision entity with
|
||||
<interfacename>@org.hibernate.envers.ModifiedEntityNames</interfacename> annotation. The property is
|
||||
required to be of <literal><![CDATA[Set<String>]]></literal> type.
|
||||
<para>
|
||||
Mark an appropriate field of a custom revision entity with
|
||||
<interfacename>@org.hibernate.envers.ModifiedEntityNames</interfacename> annotation. The property is
|
||||
required to be of <literal><![CDATA[Set<String>]]></literal> type.
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[@Entity
|
||||
@RevisionEntity
|
||||
|
@ -662,7 +668,7 @@ Set<ModifiedEntityTypeEntity> modifiedEntityTypes = revEntity.getModifiedEntityT
|
|||
|
||||
</section>
|
||||
|
||||
<section id="envers-tracking-properties-changes">
|
||||
<section xml:id="envers-tracking-properties-changes">
|
||||
<title>Tracking entity changes at property level</title>
|
||||
<para>
|
||||
By default the only information stored by Envers are revisions of modified entities.
|
||||
|
@ -681,16 +687,16 @@ Set<ModifiedEntityTypeEntity> modifiedEntityTypes = revEntity.getModifiedEntityT
|
|||
</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
setting
|
||||
<property>org.hibernate.envers.global_with_modified_flag</property>
|
||||
configuration property to
|
||||
<literal>true</literal>.
|
||||
This global switch will cause adding modification flags for all audited
|
||||
properties in all audited entities.
|
||||
<para>
|
||||
setting <property>org.hibernate.envers.global_with_modified_flag</property> configuration
|
||||
property to <literal>true</literal>. This global switch will cause adding modification flags
|
||||
for all audited properties in all audited entities.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
using <literal>@Audited(withModifiedFlag=true)</literal>
|
||||
on a property or on an entity.
|
||||
<para>
|
||||
using <literal>@Audited(withModifiedFlag=true)</literal> on a property or on an entity.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<para>
|
||||
|
@ -710,7 +716,7 @@ Set<ModifiedEntityTypeEntity> modifiedEntityTypes = revEntity.getModifiedEntityT
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="envers-queries">
|
||||
<section xml:id="envers-queries">
|
||||
|
||||
<title>Queries</title>
|
||||
|
||||
|
@ -723,9 +729,8 @@ Set<ModifiedEntityTypeEntity> modifiedEntityTypes = revEntity.getModifiedEntityT
|
|||
</para>
|
||||
|
||||
<para>
|
||||
The queries in Envers are similar to
|
||||
<ulink url="http://www.hibernate.org/hib_docs/v3/reference/en/html/querycriteria.html">Hibernate Criteria</ulink>,
|
||||
so if you are common with them, using Envers queries will be much easier.
|
||||
The queries in Envers are similar to Hibernate Criteria queries, so if you are common with them,
|
||||
using Envers queries will be much easier.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -746,7 +751,7 @@ Set<ModifiedEntityTypeEntity> modifiedEntityTypes = revEntity.getModifiedEntityT
|
|||
<xref linkend="configuration"/>.
|
||||
</para>
|
||||
|
||||
<section id="entities-at-revision">
|
||||
<section xml:id="entities-at-revision">
|
||||
|
||||
<title>Querying for entities of a class at a given revision</title>
|
||||
|
||||
|
@ -796,7 +801,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
|
||||
</section>
|
||||
|
||||
<section id="revisions-of-entity">
|
||||
<section xml:id="revisions-of-entity">
|
||||
|
||||
<title>Querying for revisions, at which entities of a given class changed</title>
|
||||
|
||||
|
@ -899,7 +904,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
|
||||
</section>
|
||||
|
||||
<section id="envers-envers-tracking-properties-changes-queries">
|
||||
<section xml:id="envers-envers-tracking-properties-changes-queries">
|
||||
|
||||
<title>Querying for revisions of entity that modified given property</title>
|
||||
|
||||
|
@ -971,7 +976,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
</section>
|
||||
|
||||
|
||||
<section id="envers-tracking-modified-entities-queries">
|
||||
<section xml:id="envers-tracking-modified-entities-queries">
|
||||
<title>Querying for entities modified in a given revision</title>
|
||||
<para>
|
||||
The basic query allows retrieving entity names and corresponding Java classes changed in a specified revision:
|
||||
|
@ -983,22 +988,28 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<firstterm><methodname>List<![CDATA[<Object>]]> findEntities(Number)</methodname></firstterm>
|
||||
- Returns snapshots of all audited entities changed (added, updated and removed) in a given revision.
|
||||
Executes <literal>n+1</literal> SQL queries, where <literal>n</literal> is a number of different entity
|
||||
classes modified within specified revision.
|
||||
<para>
|
||||
<firstterm><methodname>List<![CDATA[<Object>]]> findEntities(Number)</methodname></firstterm>
|
||||
- Returns snapshots of all audited entities changed (added, updated and removed) in a given revision.
|
||||
Executes <literal>n+1</literal> SQL queries, where <literal>n</literal> is a number of different entity
|
||||
classes modified within specified revision.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<firstterm><methodname>List<![CDATA[<Object>]]> findEntities(Number, RevisionType)</methodname></firstterm>
|
||||
- Returns snapshots of all audited entities changed (added, updated or removed) in a given revision
|
||||
filtered by modification type. Executes <literal>n+1</literal> SQL queries, where <literal>n</literal>
|
||||
is a number of different entity classes modified within specified revision.
|
||||
<para>
|
||||
<firstterm><methodname>List<![CDATA[<Object>]]> findEntities(Number, RevisionType)</methodname></firstterm>
|
||||
- Returns snapshots of all audited entities changed (added, updated or removed) in a given revision
|
||||
filtered by modification type. Executes <literal>n+1</literal> SQL queries, where <literal>n</literal>
|
||||
is a number of different entity classes modified within specified revision.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<firstterm><methodname><![CDATA[Map<RevisionType, List<Object>>]]> findEntitiesGroupByRevisionType(Number)</methodname></firstterm>
|
||||
- Returns a map containing lists of entity snapshots grouped by modification operation (e.g.
|
||||
addition, update and removal). Executes <literal>3n+1</literal> SQL queries, where <literal>n</literal>
|
||||
is a number of different entity classes modified within specified revision.
|
||||
<para>
|
||||
<firstterm><methodname><![CDATA[Map<RevisionType, List<Object>>]]> findEntitiesGroupByRevisionType(Number)</methodname></firstterm>
|
||||
- Returns a map containing lists of entity snapshots grouped by modification operation (e.g.
|
||||
addition, update and removal). Executes <literal>3n+1</literal> SQL queries, where <literal>n</literal>
|
||||
is a number of different entity classes modified within specified revision.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<para>
|
||||
|
@ -1021,28 +1032,36 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
Conditional auditing can be implemented by overriding some of the Envers event listeners.
|
||||
To use customized Envers event listeners, the following steps are needed:
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
Turn off automatic Envers event listeners registration by setting the
|
||||
<literal>hibernate.listeners.envers.autoRegister</literal>
|
||||
Hibernate property to <literal>false</literal>.
|
||||
</listitem>
|
||||
<listitem>
|
||||
Create subclasses for appropriate event listeners. For example, if you want to conditionally audit
|
||||
entity insertions, extend the
|
||||
<literal>org.hibernate.envers.eventEnversPostInsertEventListenerImpl</literal>
|
||||
class. Place the conditional-auditing logic in the subclasses, call the super method if auditing
|
||||
should be performed.
|
||||
</listitem>
|
||||
<listitem>
|
||||
Create your own implementation of <literal>org.hibernate.integrator.spi.Integrator</literal>,
|
||||
similar to <literal>org.hibernate.envers.event.EnversIntegrator</literal>. Use your event listener
|
||||
classes instead of the default ones.
|
||||
</listitem>
|
||||
<listitem>
|
||||
For the integrator to be automatically used when Hibernate starts up, you will need to add a
|
||||
<literal>META-INF/services/org.hibernate.integrator.spi.Integrator</literal> file to your jar.
|
||||
The file should contain the fully qualified name of the class implementing the interface.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Turn off automatic Envers event listeners registration by setting the
|
||||
<literal>hibernate.listeners.envers.autoRegister</literal> Hibernate property to
|
||||
<literal>false</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Create subclasses for appropriate event listeners. For example, if you want to
|
||||
conditionally audit entity insertions, extend the
|
||||
<literal>org.hibernate.envers.eventEnversPostInsertEventListenerImpl</literal>
|
||||
class. Place the conditional-auditing logic in the subclasses, call the super method if
|
||||
auditing should be performed.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Create your own implementation of <literal>org.hibernate.integrator.spi.Integrator</literal>,
|
||||
similar to <literal>org.hibernate.envers.event.EnversIntegrator</literal>. Use your event
|
||||
listener classes instead of the default ones.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
For the integrator to be automatically used when Hibernate starts up, you will need to add a
|
||||
<literal>META-INF/services/org.hibernate.integrator.spi.Integrator</literal> file to your jar.
|
||||
The file should contain the fully qualified name of the class implementing the interface.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</para>
|
||||
</section>
|
||||
|
@ -1103,7 +1122,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
</para>
|
||||
|
||||
<para>
|
||||
Additionally, there is a <term>revision entity</term> table which contains the information about the
|
||||
Additionally, there is a revision entity table which contains the information about the
|
||||
global revision. By default the generated table is named <database class="table">REVINFO</database> and
|
||||
contains just 2 columns: <database class="field">ID</database> and <database class="field">TIMESTAMP</database>.
|
||||
A row is inserted into this table on each new revision, that is, on each commit of a transaction, which
|
||||
|
@ -1124,7 +1143,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
|
||||
</section>
|
||||
|
||||
<section id="envers-generateschema">
|
||||
<section xml:id="envers-generateschema">
|
||||
<title>Generating schema with Ant</title>
|
||||
|
||||
<para>
|
||||
|
@ -1219,7 +1238,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
</section>
|
||||
|
||||
|
||||
<section id="envers-mappingexceptions">
|
||||
<section xml:id="envers-mappingexceptions">
|
||||
<title>Mapping exceptions</title>
|
||||
|
||||
<section>
|
||||
|
@ -1287,9 +1306,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
<para>
|
||||
One special case are relations mapped with <literal>@OneToMany</literal>+<literal>@JoinColumn</literal> on
|
||||
the one side, and <literal>@ManyToOne</literal>+<literal>@JoinColumn(insertable=false, updatable=false</literal>)
|
||||
on the many side.
|
||||
Such relations are in fact bidirectional, but the owning side is the collection (see alse
|
||||
<ulink url="http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-hibspec-collection-extratype">here</ulink>).
|
||||
on the many side. Such relations are in fact bidirectional, but the owning side is the collection.
|
||||
</para>
|
||||
<para>
|
||||
To properly audit such relations with Envers, you can use the <literal>@AuditMappedBy</literal> annotation.
|
||||
|
@ -1303,10 +1320,10 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="envers-partitioning">
|
||||
<section xml:id="envers-partitioning">
|
||||
<title>Advanced: Audit table partitioning</title>
|
||||
|
||||
<section id="envers-partitioning-benefits">
|
||||
<section xml:id="envers-partitioning-benefits">
|
||||
|
||||
<title>Benefits of audit table partitioning</title>
|
||||
|
||||
|
@ -1330,7 +1347,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
|
||||
</section>
|
||||
|
||||
<section id="envers-partitioning-columns">
|
||||
<section xml:id="envers-partitioning-columns">
|
||||
|
||||
<title>Suitable columns for audit table partitioning</title>
|
||||
<para>
|
||||
|
@ -1400,7 +1417,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
|
||||
</section>
|
||||
|
||||
<section id="envers-partitioning-example">
|
||||
<section xml:id="envers-partitioning-example">
|
||||
|
||||
<title>Audit table partitioning example</title>
|
||||
<para>
|
||||
|
@ -1526,7 +1543,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
</table>
|
||||
</para>
|
||||
|
||||
<section id="envers-partitioning-example-column">
|
||||
<section xml:id="envers-partitioning-example-column">
|
||||
|
||||
<title>Determining a suitable partitioning column</title>
|
||||
<para>
|
||||
|
@ -1563,7 +1580,7 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
|
||||
</section>
|
||||
|
||||
<section id="envers-partitioning-example-scheme">
|
||||
<section xml:id="envers-partitioning-example-scheme">
|
||||
|
||||
<title>Determining a suitable partitioning scheme</title>
|
||||
<para>
|
||||
|
@ -1631,39 +1648,39 @@ query.add(AuditEntity.relatedId("address").eq(relatedEntityId));]]></programlist
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="envers-links">
|
||||
<section xml:id="envers-links">
|
||||
<title>Envers links</title>
|
||||
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://hibernate.org">Hibernate main page</ulink>
|
||||
<link xl:href="http://hibernate.org">Hibernate main page</link>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://community.jboss.org/en/envers?view=discussions">Forum</ulink>
|
||||
<link xl:href="http://community.jboss.org/en/envers?view=discussions">Forum</link>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://opensource.atlassian.com/projects/hibernate/browse/HHH">JIRA issue tracker</ulink>
|
||||
<link xl:href="http://opensource.atlassian.com/projects/hibernate/browse/HHH">JIRA issue tracker</link>
|
||||
(when adding issues concerning Envers, be sure to select the "envers" component!)
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="irc://irc.freenode.net:6667/envers">IRC channel</ulink>
|
||||
<link xl:href="irc://irc.freenode.net:6667/envers">IRC channel</link>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://www.jboss.org/feeds/view/envers">Envers Blog</ulink>
|
||||
<link xl:href="http://www.jboss.org/feeds/view/envers">Envers Blog</link>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="https://community.jboss.org/wiki/EnversFAQ">FAQ</ulink>
|
||||
<link xl:href="https://community.jboss.org/wiki/EnversFAQ">FAQ</link>
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
|
|
@ -1,28 +1,51 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!DOCTYPE book SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<book>
|
||||
<xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Database_Access.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="chapters/transactions/Transactions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="chapters/pc/Persistence_Context.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Batch_Processing.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Locking.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Caching.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="chapters/services/Services.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Data_Categorizations.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Mapping_Entities.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Mapping_Association.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="chapters/query_ql/HQL_JPQL.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="chapters/query_criteria/Criteria.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="chapters/query_native/Native_SQL.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="JMX.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="Envers.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="chapters/multitenancy/Multi_Tenancy.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="appendix-Configuration_Properties.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="appendices/legacy_criteria/Legacy_Criteria.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<info>
|
||||
<title>Hibernate Developer Guide</title>
|
||||
<releaseinfo>&version;</releaseinfo>
|
||||
<productname>Hibernate O/RM</productname>
|
||||
<productnumber>&version;</productnumber>
|
||||
<pubdate>&today;</pubdate>
|
||||
<mediaobject>
|
||||
<imageobject role="fo">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" align="center" />
|
||||
</imageobject>
|
||||
<imageobject role="html">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" depth="3cm" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
<copyright>
|
||||
<year>©rightYear;</year>
|
||||
<holder>©rightHolder;</holder>
|
||||
</copyright>
|
||||
|
||||
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
</info>
|
||||
|
||||
|
||||
<xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="Database_Access.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="chapters/transactions/Transactions.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="chapters/pc/Persistence_Context.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="Batch_Processing.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="Locking.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="Caching.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="chapters/services/Services.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="Data_Categorizations.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="Mapping_Entities.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="Mapping_Association.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="chapters/query_ql/HQL_JPQL.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="chapters/query_criteria/Criteria.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="chapters/query_native/Native_SQL.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="JMX.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="Envers.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="chapters/multitenancy/Multi_Tenancy.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="appendix-Configuration_Properties.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
<xi:include href="appendices/legacy_criteria/Legacy_Criteria.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
</book>
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
<title>JMX</title> <para> </para> </chapter>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook">
|
||||
<title>JMX</title>
|
||||
<para> </para>
|
||||
</chapter>
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" >
|
||||
<title>Locking</title>
|
||||
<para>
|
||||
Locking refers to actions taken to prevent data in a relational database from changing between the time it is read
|
||||
|
@ -21,8 +18,7 @@
|
|||
Optimistic locking ssumes that multiple transactions can complete without affecting each other, and that
|
||||
therefore transactions can proceed without locking the data resources that they affect. Before committing,
|
||||
each transaction verifies that no other transaction has modified its data. If the check reveals conflicting
|
||||
modifications, the committing transaction rolls back<footnote><para><ulink
|
||||
url="http://en.wikipedia.org/wiki/Optimistic_locking" /></para></footnote>.
|
||||
modifications, the committing transaction rolls back<footnote><para><link xl:href="http://en.wikipedia.org/wiki/Optimistic_locking" /></para></footnote>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
<title>Mapping associations</title>
|
||||
<para>
|
||||
The most basic form of mapping in Hibernate is mapping a persistent entity class to a database table. You can expand
|
||||
on this concept by mapping associated classes together. <xref linkend="mapping-person" /> shows a
|
||||
<classname>Person</classname> class with a
|
||||
</para>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" >
|
||||
<title>Mapping associations</title>
|
||||
<para>
|
||||
The most basic form of mapping in Hibernate is mapping a persistent entity class to a database table.
|
||||
You can expand on this concept by mapping associated classes together. <xref linkend="mapping-person" />
|
||||
shows a <classname>Person</classname> class with a
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="devguide-mappingEntities">
|
||||
<title>Mapping entities</title>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" >
|
||||
<title>Mapping entities</title>
|
||||
<section>
|
||||
<title>Hierarchies</title>
|
||||
<para></para>
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<preface id="pref-Hibernate_Development_Guide-Preface">
|
||||
|
||||
<preface xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" >
|
||||
|
||||
<title>Preface</title>
|
||||
<para>
|
||||
|
@ -13,7 +9,7 @@
|
|||
objects versus relational databases. Hibernate is an Object/Relational Mapping solution for Java environments.
|
||||
The term Object/Relational Mapping refers to the technique of mapping data from an object model representation
|
||||
to a relational data model representation (and visa versa). See
|
||||
<ulink url="http://en.wikipedia.org/wiki/Object-relational_mapping"/> for a good high-level discussion.
|
||||
<link xl:href="http://en.wikipedia.org/wiki/Object-relational_mapping"/> for a good high-level discussion.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
|
@ -25,12 +21,12 @@
|
|||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://www.agiledata.org/essays/dataModeling101.html"/>
|
||||
<link xl:href="http://www.agiledata.org/essays/dataModeling101.html"/>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://en.wikipedia.org/wiki/Data_modeling"/>
|
||||
<link xl:href="http://en.wikipedia.org/wiki/Data_modeling"/>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
@ -61,19 +57,19 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Use Hibernate and report any bugs or issues you find. See
|
||||
<ulink url="http://hibernate.org/issuetracker.html"/> for details.
|
||||
<link xl:href="http://hibernate.org/issuetracker.html"/> for details.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Try your hand at fixing some bugs or implementing enhancements. Again, see
|
||||
<ulink url="http://hibernate.org/issuetracker.html"/>.
|
||||
<link xl:href="http://hibernate.org/issuetracker.html"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Engage with the community using mailing lists, forums, IRC, or other ways listed at
|
||||
<ulink url="http://hibernate.org/community.html"/>.
|
||||
<link xl:href="http://hibernate.org/community.html"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
|
|
@ -1,36 +1,9 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2012, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
|
||||
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<appendix id="query-criteria-legacy">
|
||||
<title>Legacy Hibernate Criteria Queries</title>
|
||||
<appendix xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink">
|
||||
<info>
|
||||
<title>Legacy Hibernate Criteria Queries</title>
|
||||
</info>
|
||||
|
||||
<note>
|
||||
<para>
|
||||
|
@ -38,7 +11,7 @@
|
|||
should be considered deprecated. New development should focus on the JPA
|
||||
<interfacename>javax.persistence.criteria.CriteriaQuery</interfacename> API. Eventually,
|
||||
Hibernate-specific criteria features will be ported as extensions to the JPA
|
||||
<interface>javax.persistence.criteria.CriteriaQuery</interface>. For details on the JPA APIs, see
|
||||
<interfacename>javax.persistence.criteria.CriteriaQuery</interfacename>. For details on the JPA APIs, see
|
||||
<xref linkend="query-criteria"/>.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -50,7 +23,7 @@
|
|||
Hibernate features an intuitive, extensible criteria query API.
|
||||
</para>
|
||||
|
||||
<section id="querycriteria-creating">
|
||||
<section xml:id="querycriteria-creating">
|
||||
<title>Creating a <literal>Criteria</literal> instance</title>
|
||||
|
||||
<para>
|
||||
|
@ -65,7 +38,7 @@ List cats = crit.list();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-narrowing">
|
||||
<section xml:id="querycriteria-narrowing">
|
||||
<title>Narrowing the result set</title>
|
||||
|
||||
<para>
|
||||
|
@ -137,7 +110,7 @@ List cats = sess.createCriteria(Cat.class)
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-ordering">
|
||||
<section xml:id="querycriteria-ordering">
|
||||
<title>Ordering the results</title>
|
||||
|
||||
<para>
|
||||
|
@ -160,7 +133,7 @@ List cats = sess.createCriteria(Cat.class)
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-associations" revision="2">
|
||||
<section xml:id="querycriteria-associations">
|
||||
<title>Associations</title>
|
||||
|
||||
<para>
|
||||
|
@ -244,7 +217,7 @@ while ( iter.hasNext() ) {
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-dynamicfetching" revision="1">
|
||||
<section xml:id="querycriteria-dynamicfetching">
|
||||
<title>Dynamic association fetching</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<appendix id="appendix-Configuration_Properties">
|
||||
|
||||
<appendix xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xl="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>Configuration properties</title>
|
||||
<section>
|
||||
<title>General Configuration</title>
|
||||
|
@ -359,8 +358,8 @@
|
|||
</table>
|
||||
<note>
|
||||
<para>
|
||||
For information on specific configuration of Proxool, refer to the Proxool documentation available from <ulink
|
||||
url="http://proxool.sourceforge.net/" />.
|
||||
For information on specific configuration of Proxool, refer to the Proxool documentation available from
|
||||
<link xl:href="http://proxool.sourceforge.net/" />.
|
||||
</para>
|
||||
</note>
|
||||
</section>
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<appendix id="appendix-Troubleshooting">
|
||||
|
||||
<appendix xmlns="http://docbook.org/ns/docbook">
|
||||
|
||||
<title>Troubleshooting</title>
|
||||
|
||||
<section>
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
<chapter xml:id="events"
|
||||
xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
xmlns:xl="http://www.w3.org/1999/xlink">
|
||||
|
||||
<chapter id="events">
|
||||
<title>Interceptors and events</title>
|
||||
|
||||
<para>
|
||||
|
@ -42,7 +41,7 @@
|
|||
A Session-scoped interceptor is specified when a session is opened.
|
||||
</para>
|
||||
|
||||
<programlisting role="JAVA"><xi:include href="extras/SessionScopedExample.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/SessionScopedExample.java" parse="text"/></programlisting>
|
||||
|
||||
<para>
|
||||
A SessionFactory-scoped interceptor is registered with the <classname>Configuration</classname> object
|
||||
|
@ -52,7 +51,7 @@
|
|||
states, since multiple sessions will use this interceptor potentially concurrently.
|
||||
</para>
|
||||
|
||||
<programlisting role="JAVA"><xi:include href="extras/SessionFactoryScopedExample.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/SessionFactoryScopedExample.java" parse="text"/></programlisting>
|
||||
|
||||
</section>
|
||||
|
||||
|
@ -96,10 +95,10 @@
|
|||
</para>
|
||||
|
||||
<example>
|
||||
<blockinfo>
|
||||
<info>
|
||||
<title>Custom LoadListener example</title>
|
||||
</blockinfo>
|
||||
<programlisting role="JAVA"><xi:include href="extras/LoadListenerExample.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
</info>
|
||||
<programlisting role="JAVA"><xi:include href="extras/LoadListenerExample.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<section>
|
||||
|
@ -118,9 +117,9 @@
|
|||
</para>
|
||||
|
||||
<example>
|
||||
<blockinfo>
|
||||
<info>
|
||||
<title>JACC listener registration example</title>
|
||||
</blockinfo>
|
||||
</info>
|
||||
<programlisting role="JAVA"><xi:include href="extras/jacc-event-reg-example.java" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude" /></programlisting>
|
||||
</example>
|
||||
|
||||
|
@ -233,10 +232,10 @@
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
<example>
|
||||
<blockinfo>
|
||||
<info>
|
||||
<title>Example of specifying JPA callbacks</title>
|
||||
</blockinfo>
|
||||
<programlisting role="JAVA"><xi:include href="extras/JpaCallbacksExample.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
</info>
|
||||
<programlisting role="JAVA"><xi:include href="extras/JpaCallbacksExample.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
These approaches can be mixed, meaning you can use both together.
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<chapter>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xl="http://www.w3.org/1999/xlink"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>Multi-tenancy</title>
|
||||
|
||||
<section>
|
||||
|
@ -29,7 +28,7 @@
|
|||
<para>
|
||||
Each approach has pros and cons as well as specific techniques and considerations. Such
|
||||
topics are beyond the scope of this documentation. Many resources exist which delve into these
|
||||
other topics. One example is <ulink url=" http://msdn.microsoft.com/en-us/library/aa479086.aspx"/>
|
||||
other topics. One example is <link xl:href="http://msdn.microsoft.com/en-us/library/aa479086.aspx"/>
|
||||
which does a great job of covering these topics.
|
||||
</para>
|
||||
</note>
|
||||
|
@ -126,7 +125,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Specifying tenant identifier from <interfacename>SessionFactory</interfacename></title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/tenant-identifier-from-SessionFactory.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/tenant-identifier-from-SessionFactory.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Additionally, when specifying configuration, a <classname>org.hibernate.MultiTenancyStrategy</classname>
|
||||
|
@ -264,7 +263,7 @@
|
|||
<title>Strategies for <interfacename>MultiTenantConnectionProvider</interfacename> implementors</title>
|
||||
<example>
|
||||
<title>Implementing MultiTenantConnectionProvider using different connection pools</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MultiTenantConnectionProviderImpl-multi-cp.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MultiTenantConnectionProviderImpl-multi-cp.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The approach above is valid for the DATABASE approach. It is also valid for the SCHEMA approach
|
||||
|
@ -272,7 +271,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Implementing MultiTenantConnectionProvider using single connection pool</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MultiTenantConnectionProviderImpl-single-cp.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MultiTenantConnectionProviderImpl-single-cp.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
This approach is only relevant to the SCHEMA approach.
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
<title>Persistence Contexts</title>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<info>
|
||||
<title>Persistence Contexts</title>
|
||||
</info>
|
||||
|
||||
<para>
|
||||
Both the <interfacename>org.hibernate.Session</interfacename> API and
|
||||
|
@ -66,8 +67,8 @@
|
|||
|
||||
<example>
|
||||
<title>Example of making an entity persistent</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MakingPersistentWithSession.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MakingPersistentWithEM.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MakingPersistentWithSession.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MakingPersistentWithEM.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -92,8 +93,8 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Example of deleting an entity</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/DeletingWithSession.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/DeletingWithEM.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/DeletingWithSession.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/DeletingWithEM.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
It is important to note that Hibernate itself can handle deleting detached state. JPA, however, disallows
|
||||
|
@ -179,8 +180,8 @@
|
|||
|
||||
<example>
|
||||
<title>Example of modifying managed state</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ManagedUpdateWithSession.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ManagedUpdateWithEM.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ManagedUpdateWithSession.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ManagedUpdateWithEM.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -214,8 +215,8 @@
|
|||
</important>
|
||||
<example>
|
||||
<title>Example of reattaching a detached entity</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ReattachingWithSession1.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ReattachingWithSession2.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ReattachingWithSession1.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ReattachingWithSession2.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The method name <methodname>update</methodname> is a bit misleading here. It does not mean that an
|
||||
|
@ -239,15 +240,15 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Visualizing merge</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/VisualizingMerge.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/VisualizingMerge.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
That is not exactly what happens, but its a good visualization.
|
||||
</para>
|
||||
<example>
|
||||
<title>Example of merging a detached entity</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MergeWithSession.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MergeWithEM.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MergeWithSession.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/MergeWithEM.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -262,13 +263,13 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Examples of verifying managed state</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ContainsWithSession.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ContainsWithEM.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ContainsWithSession.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/ContainsWithEM.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Examples of verifying laziness</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/CheckingLazinessWithHibernate.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/CheckingLazinessWithJPA.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/CheckingLazinessWithHibernate.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/CheckingLazinessWithJPA.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
In JPA there is an alternative means to check laziness using the following
|
||||
|
@ -277,7 +278,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Alternative JPA means to verify laziness</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/CheckingLazinessWithJPA2.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/CheckingLazinessWithJPA2.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
</section>
|
||||
|
@ -289,7 +290,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Usage of EntityManager.unwrap</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/UnwrapWithEM.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/UnwrapWithEM.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
</chapter>
|
|
@ -1,9 +1,8 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="query-criteria">
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>Criteria</title>
|
||||
|
||||
<para>
|
||||
|
@ -12,11 +11,11 @@
|
|||
|
||||
<important>
|
||||
<para>
|
||||
Hibernate offers an older, legacy <interface>org.hibernate.Criteria</interface> API which should be
|
||||
Hibernate offers an older, legacy <interfacename>org.hibernate.Criteria</interfacename> API which should be
|
||||
considered deprecated. No feature development will target those APIs. Eventually, Hibernate-specific
|
||||
criteria features will be ported as extensions to the JPA
|
||||
<interface>javax.persistence.criteria.CriteriaQuery</interface>. For details on the
|
||||
<interface>org.hibernate.Criteria</interface> API, see <xref linkend="query-criteria-legacy"/>.
|
||||
<interfacename>javax.persistence.criteria.CriteriaQuery</interfacename>. For details on the
|
||||
<interfacename>org.hibernate.Criteria</interfacename> API, see <xref linkend="query-criteria-legacy"/>.
|
||||
</para>
|
||||
<para>
|
||||
This chapter will focus on the JPA APIs for declaring type-safe criteria queries.
|
||||
|
@ -51,7 +50,7 @@
|
|||
<interfacename>javax.persistence.criteria.CriteriaBuilder</interfacename> for this purpose:
|
||||
</para>
|
||||
|
||||
<programlisting role="JAVA"><xi:include href="extras/CriteriaBuilder_query_creation_snippet.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/CriteriaBuilder_query_creation_snippet.java" parse="text"/></programlisting>
|
||||
|
||||
<para>
|
||||
Each serves a different purpose depending on the expected type of the query results.
|
||||
|
@ -83,7 +82,7 @@
|
|||
|
||||
<example id="ex-criteria-typedquery-entity">
|
||||
<title>Selecting the root entity</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_root_entity_example.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_root_entity_example.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -116,7 +115,7 @@
|
|||
|
||||
<example id="ex-criteria-typedquery-attribute">
|
||||
<title>Selecting an attribute</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_attribute_example.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_attribute_example.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -141,7 +140,7 @@
|
|||
|
||||
<example id="ex-criteria-typedquery-array">
|
||||
<title>Selecting an array</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_multiple_values_array.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_multiple_values_array.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -158,7 +157,7 @@
|
|||
|
||||
<example id="ex-criteria-typedquery-array2">
|
||||
<title>Selecting an array (2)</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_multiple_values_array2.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_multiple_values_array2.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -181,7 +180,7 @@
|
|||
|
||||
<example id="ex-criteria-typedquery-construct">
|
||||
<title>Selecting an wrapper</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_wrapper.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_wrapper.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -213,7 +212,7 @@
|
|||
|
||||
<example id="ex-criteria-typedquery-tuple">
|
||||
<title>Selecting a tuple</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_tuple.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/select_tuple.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -311,11 +310,11 @@
|
|||
<interfacename>javax.persistence.criteria.CriteriaQuery</interfacename>:
|
||||
</para>
|
||||
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_root_methods.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_root_methods.java" parse="text"/></programlisting>
|
||||
|
||||
<example>
|
||||
<title>Adding a root</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_root_example.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_root_example.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -326,7 +325,7 @@
|
|||
|
||||
<example>
|
||||
<title>Adding multiple roots</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_root_example_multiple.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_root_example_multiple.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -342,12 +341,12 @@
|
|||
|
||||
<example id="criteria-join-singular">
|
||||
<title>Example with Embedded and ManyToOne</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_join_example_embedded_and_many2one.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_join_example_embedded_and_many2one.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<example id="criteria-join-plural">
|
||||
<title>Example with Collections</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_join_example_plural.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_join_example_plural.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -362,7 +361,7 @@
|
|||
|
||||
<example id="criteria-fetch-singular">
|
||||
<title>Example with Embedded and ManyToOne</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_fetch_example_embedded_and_many2one.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_fetch_example_embedded_and_many2one.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<note>
|
||||
|
@ -375,7 +374,7 @@
|
|||
|
||||
<example id="criteria-fetch-plural">
|
||||
<title>Example with Collections</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_fetch_example_plural.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/from_fetch_example_plural.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -394,7 +393,7 @@
|
|||
|
||||
<example id="ex-querycriteria-param">
|
||||
<title>Using parameters</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/parameter_example.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/parameter_example.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<chapter>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook">
|
||||
|
||||
<title>Native SQL Queries</title>
|
||||
|
||||
<para>
|
||||
|
@ -15,7 +12,7 @@
|
|||
create, update, delete, and load operations.
|
||||
</para>
|
||||
|
||||
<section id="querysql-creating" revision="4">
|
||||
<section xml:id="querysql-creating">
|
||||
<title>Using a <literal>SQLQuery</literal></title>
|
||||
|
||||
<para>Execution of native SQL queries is controlled via the
|
||||
|
@ -226,7 +223,7 @@ List loggedCats = sess.createSQLQuery(sql)
|
|||
.addEntity("mother", Cat.class).list()
|
||||
</programlisting>
|
||||
|
||||
<section id="querysql-aliasreferences" revision="2">
|
||||
<section xml:id="querysql-aliasreferences" >
|
||||
<title>Alias and property references</title>
|
||||
|
||||
<para>In most cases the above alias injection is needed. For queries
|
||||
|
@ -239,7 +236,7 @@ List loggedCats = sess.createSQLQuery(sql)
|
|||
simply examples; each alias will have a unique and probably different
|
||||
name when used.</para>
|
||||
|
||||
<table frame="topbot" id="aliasinjection-summary">
|
||||
<table frame="topbot" xml:id="aliasinjection-summary">
|
||||
<title>Alias injection names</title>
|
||||
|
||||
<tgroup cols="3">
|
||||
|
@ -394,7 +391,7 @@ List pusList = query.setString("name", "Pus%").list(); </programlisting
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="querysql-namedqueries" revision="3">
|
||||
<section xml:id="querysql-namedqueries" >
|
||||
<title>Named SQL queries</title>
|
||||
|
||||
<para>Named SQL queries can also be defined in the mapping document and
|
||||
|
@ -550,7 +547,7 @@ List pusList = query.setString("name", "Pus%").list(); </programlisting
|
|||
This can be seen in <xref
|
||||
linkend="example-field-result-annotation-with-associations" />.</para>
|
||||
|
||||
<example id="example-named-native-query-annotation-with-result-set-mapping">
|
||||
<example xml:id="example-named-native-query-annotation-with-result-set-mapping">
|
||||
<title>Named SQL query using <classname>@NamedNativeQuery</classname>
|
||||
together with <classname>@SqlResultSetMapping</classname></title>
|
||||
|
||||
|
@ -574,7 +571,7 @@ List pusList = query.setString("name", "Pus%").list(); </programlisting
|
|||
)</programlisting>
|
||||
</example>
|
||||
|
||||
<example id="example-implicit-result-set-mapping">
|
||||
<example xml:id="example-implicit-result-set-mapping">
|
||||
<title>Implicit result set mapping</title>
|
||||
|
||||
<programlisting language="JAVA" role="JAVA">@Entity
|
||||
|
@ -616,7 +613,7 @@ public class SpaceShip {
|
|||
}</programlisting>
|
||||
</example>
|
||||
|
||||
<example id="example-field-result-annotation-with-associations">
|
||||
<example xml:id="example-field-result-annotation-with-associations">
|
||||
<title>Using dot notation in @FieldResult for specifying associations
|
||||
</title>
|
||||
|
||||
|
@ -747,7 +744,7 @@ public class SpaceShip {</programlisting>
|
|||
<literal>org.hibernate.callable</literal> which can be true or false
|
||||
depending on whether the query is a stored procedure or not.</para>
|
||||
|
||||
<section id="propertyresults">
|
||||
<section xml:id="propertyresults">
|
||||
<title>Using return-property to explicitly specify column/alias
|
||||
names</title>
|
||||
|
||||
|
@ -800,7 +797,7 @@ public class SpaceShip {</programlisting>
|
|||
discriminator column.</para>
|
||||
</section>
|
||||
|
||||
<section id="sp_query" revision="1">
|
||||
<section xml:id="sp_query" >
|
||||
<title>Using stored procedures for querying</title>
|
||||
|
||||
<para>Hibernate3 provides support for queries via stored procedures and
|
||||
|
@ -845,7 +842,7 @@ BEGIN
|
|||
<literal><return-join></literal> and
|
||||
<literal><load-collection></literal> are not supported.</para>
|
||||
|
||||
<section id="querysql-limits-storedprocedures" revision="1">
|
||||
<section xml:id="querysql-limits-storedprocedures" >
|
||||
<title>Rules/limitations for using stored procedures</title>
|
||||
|
||||
<para>You cannot use stored procedures with Hibernate unless you
|
||||
|
@ -898,7 +895,7 @@ BEGIN
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="querysql-cud">
|
||||
<section xml:id="querysql-cud">
|
||||
<title>Custom SQL for create, update and delete</title>
|
||||
|
||||
<para>Hibernate3 can use custom SQL for create, update, and delete
|
||||
|
@ -936,7 +933,7 @@ public class Chaos {
|
|||
<literal><sql-delete></literal> nodes. This can be seen in <xref
|
||||
linkend="example-custom-crdu-via-xml" />.</para>
|
||||
|
||||
<example id="example-custom-crdu-via-xml">
|
||||
<example xml:id="example-custom-crdu-via-xml">
|
||||
<title>Custom CRUD XML</title>
|
||||
|
||||
<programlisting role="XML"><class name="Person">
|
||||
|
@ -981,7 +978,7 @@ public class Chaos {
|
|||
to override the collection related statements -see <xref
|
||||
linkend="example-overriding-sql-collections-annotations" />.</para>
|
||||
|
||||
<example id="example-overriding-sql-collections-annotations">
|
||||
<example xml:id="example-overriding-sql-collections-annotations">
|
||||
<title>Overriding SQL statements for collections using
|
||||
annotations</title>
|
||||
|
||||
|
@ -1057,7 +1054,7 @@ END updatePerson;</programlisting>
|
|||
</example>
|
||||
</section>
|
||||
|
||||
<section id="querysql-load">
|
||||
<section xml:id="querysql-load">
|
||||
<title>Custom SQL for loading</title>
|
||||
|
||||
<para>You can also declare your own SQL (or HQL) queries for entity
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="query-ql">
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>HQL and JPQL</title>
|
||||
|
||||
<para>
|
||||
|
@ -64,7 +63,7 @@
|
|||
<para>
|
||||
The BNF for <literal>SELECT</literal> statements in HQL is:
|
||||
</para>
|
||||
<programlisting><xi:include href="extras/statement_select_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/statement_select_bnf.txt" parse="text"/></programlisting>
|
||||
<para>
|
||||
The simplest possible HQL <literal>SELECT</literal> statement is of the form:
|
||||
</para>
|
||||
|
@ -86,7 +85,7 @@
|
|||
<para>
|
||||
The BNF for <literal>UPDATE</literal> statements is the same in HQL and JPQL:
|
||||
</para>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_update_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_update_bnf.txt" parse="text"/></programlisting>
|
||||
<para>
|
||||
<literal>UPDATE</literal> statements, by default, do not effect the <literal>version</literal>
|
||||
or the <literal>timestamp</literal> attribute values for the affected entities. However,
|
||||
|
@ -112,9 +111,9 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Example UPDATE query statements</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_update_example_hql.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_update_example_jpql.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_update_example_hql_versioned.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_update_example_hql.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_update_example_jpql.java" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_update_example_hql_versioned.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -130,7 +129,7 @@
|
|||
<para>
|
||||
The BNF for <literal>DELETE</literal> statements is the same in HQL and JPQL:
|
||||
</para>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_delete_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_delete_bnf.txt" parse="text"/></programlisting>
|
||||
<para>
|
||||
A <literal>DELETE</literal> statement is also executed using the <methodname>executeUpdate</methodname>
|
||||
method of either <interfacename>org.hibernate.Query</interfacename> or
|
||||
|
@ -144,7 +143,7 @@
|
|||
HQL adds the ability to define <literal>INSERT</literal> statements as well. There is no JPQL
|
||||
equivalent to this. The BNF for an HQL <literal>INSERT</literal> statement is:
|
||||
</para>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_insert_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_insert_bnf.txt" parse="text"/></programlisting>
|
||||
<para>
|
||||
The <literal>attribute_list</literal> is analogous to the <literal>column specification</literal> in the
|
||||
SQL <literal>INSERT</literal> statement. For entities involved in mapped inheritance, only attributes
|
||||
|
@ -179,7 +178,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Example INSERT query statements</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_insert_example_named_id.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/statement_insert_example_named_id.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -223,10 +222,10 @@
|
|||
<para>
|
||||
The BNF for a root entity reference is:
|
||||
</para>
|
||||
<programlisting role="JAVA"><xi:include href="extras/root_entity_ref_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/root_entity_ref_bnf.txt" parse="text"/></programlisting>
|
||||
<example id="ql-simple-query-ex">
|
||||
<title>Simple query example</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/simplest_query.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/simplest_query.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
We see that the query is defining a root entity reference to the <classname>com.acme.Cat</classname>
|
||||
|
@ -240,15 +239,15 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Simple query using entity name for root entity reference</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/simplest_query2.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/simplest_query2.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Multiple root entity references can also be specified. Even naming the same entity!
|
||||
</para>
|
||||
<example>
|
||||
<title>Simple query using multiple root entity references</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/multiple_root_entity_ref_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/multiple_root_entity_ref_example2.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/multiple_root_entity_ref_example.txt" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/multiple_root_entity_ref_example2.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
<section>
|
||||
|
@ -260,11 +259,11 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Explicit inner join examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_explicit_inner.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_explicit_inner.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>Explicit left (outer) join examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_explicit_outer.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_explicit_outer.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
An important use case for explicit joins is to define <literal>FETCH JOINS</literal> which override
|
||||
|
@ -273,7 +272,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Fetch join example</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_fetch.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_fetch.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
As you can see from the example, a fetch join is specified by injecting the keyword <literal>fetch</literal>
|
||||
|
@ -304,7 +303,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>with-clause join example</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_with.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_with.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The important distinction is that in the generated SQL the conditions of the
|
||||
|
@ -329,7 +328,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Simple implicit join example</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_implicit.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/join_example_implicit.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
An implicit join always starts from an <literal>identification variable</literal>, followed by
|
||||
|
@ -343,7 +342,7 @@
|
|||
</para>
|
||||
<important>
|
||||
<para>
|
||||
If the attribute represents an entity association (non-collection) or a coponent/embedded, that
|
||||
If the attribute represents an entity association (non-collection) or a component/embedded, that
|
||||
reference can be further navigated. Basic values and collection-valued associations cannot be
|
||||
further navigated.
|
||||
</para>
|
||||
|
@ -355,7 +354,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Reused implicit join</title>
|
||||
<programlisting><xi:include href="extras/join_example_implicit_reused.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/join_example_implicit_reused.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Just as with explicit joins, implicit joins may reference association or component/embedded attributes.
|
||||
|
@ -374,7 +373,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Collection references example</title>
|
||||
<programlisting><xi:include href="extras/collection_reference_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/collection_reference_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
In the example, the identification variable <literal>o</literal> actually refers to the object model
|
||||
|
@ -395,7 +394,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Qualified collection references example</title>
|
||||
<programlisting><xi:include href="extras/qualified_path_expressions_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/qualified_path_expressions_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -504,7 +503,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>String literal examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/string_literals_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/string_literals_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -512,7 +511,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Numeric literal examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/numeric_literals_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/numeric_literals_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
In the scientific notation form, the <literal>E</literal> is case insensitive.
|
||||
|
@ -558,7 +557,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Named parameter examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/named_parameter_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/named_parameter_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
<section>
|
||||
|
@ -570,7 +569,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Positional (JPQL) parameter examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/jpql_positional_parameter_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/jpql_positional_parameter_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
<section>
|
||||
|
@ -593,7 +592,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Numeric arithmetic examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/arithmetic_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/arithmetic_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The following rules apply to the result of arithmetic operations:
|
||||
|
@ -651,7 +650,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Concatenation operation example</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/concat_op_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/concat_op_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See <xref linkend="ql-exp-functions"/> for details on the <literal>concat()</literal> function
|
||||
|
@ -697,7 +696,7 @@
|
|||
</itemizedlist>
|
||||
<example>
|
||||
<title>Aggregate function examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/agg_func_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/agg_func_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Aggregations often appear with grouping. For information on grouping see <xref linkend="ql-grouping"/>
|
||||
|
@ -734,7 +733,7 @@
|
|||
<para>
|
||||
Extracts a portion of a string value.
|
||||
</para>
|
||||
<programlisting><xi:include href="extras/substring_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/substring_bnf.txt" parse="text"/></programlisting>
|
||||
<para>
|
||||
The second argument denotes the starting position. The third (optional) argument
|
||||
denotes the length.
|
||||
|
@ -779,7 +778,7 @@
|
|||
<para>
|
||||
Locates a string within another string.
|
||||
</para>
|
||||
<programlisting><xi:include href="extras/locate_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/locate_bnf.txt" parse="text"/></programlisting>
|
||||
<para>
|
||||
The third argument (optional) is used to denote a position from which to start looking.
|
||||
</para>
|
||||
|
@ -1018,14 +1017,14 @@
|
|||
</variablelist>
|
||||
<example>
|
||||
<title>Collection-related expressions examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/collection_expression_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/collection_expression_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Elements of indexed collections (arrays, lists, and maps) can be referred to by index operator.
|
||||
</para>
|
||||
<example>
|
||||
<title>Index operator examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/index_operator_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/index_operator_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <xref linkend="ql-collection-qualification"/> as there is a good deal of overlap.
|
||||
|
@ -1044,7 +1043,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Entity type expression examples</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/entity_type_exp_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/entity_type_exp_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
HQL also has a legacy form of referring to an entity type, though that legacy form is considered
|
||||
|
@ -1064,10 +1063,10 @@
|
|||
<para>
|
||||
The simple form has the following syntax:
|
||||
</para>
|
||||
<programlisting><xi:include href="extras/simple_case_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/simple_case_bnf.txt" parse="text"/></programlisting>
|
||||
<example>
|
||||
<title>Simple case expression example</title>
|
||||
<programlisting><xi:include href="extras/simple_case_exp_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/simple_case_exp_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
<section>
|
||||
|
@ -1075,10 +1074,10 @@
|
|||
<para>
|
||||
The searched form has the following syntax:
|
||||
</para>
|
||||
<programlisting><xi:include href="extras/searched_case_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/searched_case_bnf.txt" parse="text"/></programlisting>
|
||||
<example>
|
||||
<title>Searched case expression example</title>
|
||||
<programlisting><xi:include href="extras/searched_case_exp_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/searched_case_exp_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
<section>
|
||||
|
@ -1088,7 +1087,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>NULLIF example</title>
|
||||
<programlisting><xi:include href="extras/nullif_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/nullif_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
<section>
|
||||
|
@ -1118,7 +1117,7 @@
|
|||
|
||||
<example>
|
||||
<title>Dynamic instantiation example - constructor</title>
|
||||
<programlisting><xi:include href="extras/ctor_dynamic_instantiation_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/ctor_dynamic_instantiation_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
|
@ -1137,7 +1136,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Dynamic instantiation example - list</title>
|
||||
<programlisting><xi:include href="extras/list_dynamic_instantiation_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/list_dynamic_instantiation_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The results from this query will be a <![CDATA[List<List>]]> as opposed to a <![CDATA[List<Object[]>]]>
|
||||
|
@ -1148,7 +1147,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Dynamic instantiation example - map</title>
|
||||
<programlisting><xi:include href="extras/map_dynamic_instantiation_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/map_dynamic_instantiation_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The results from this query will be a <![CDATA[List<Map<String,Object>>]]> as opposed to a
|
||||
|
@ -1175,7 +1174,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Relational comparison examples</title>
|
||||
<programlisting><xi:include href="extras/predicate_comparison_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/predicate_comparison_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Comparisons can also involve subquery qualifiers - <literal>ALL</literal>, <literal>ANY</literal>,
|
||||
|
@ -1187,7 +1186,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>ALL subquery comparison qualifier example</title>
|
||||
<programlisting><xi:include href="extras/predicate_comparison_example_using_all.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/predicate_comparison_example_using_all.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The ANY/SOME qualifier resolves to true if the comparison is true for some of (at least one of) the
|
||||
|
@ -1203,7 +1202,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Nullness checking examples</title>
|
||||
<programlisting><xi:include href="extras/predicate_nullness_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/predicate_nullness_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -1212,7 +1211,7 @@
|
|||
<para>
|
||||
Performs a like comparison on string values. The syntax is:
|
||||
</para>
|
||||
<programlisting><xi:include href="extras/predicate_like_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/predicate_like_bnf.txt" parse="text"/></programlisting>
|
||||
<para>
|
||||
The semantics follow that of the SQL like expression. The <literal>pattern_value</literal> is the
|
||||
pattern to attempt to match in the <literal>string_expression</literal>. Just like SQL,
|
||||
|
@ -1228,7 +1227,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Like predicate examples</title>
|
||||
<programlisting><xi:include href="extras/predicate_like_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/predicate_like_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -1240,7 +1239,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Between predicate examples</title>
|
||||
<programlisting><xi:include href="extras/predicate_between_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/predicate_between_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -1250,7 +1249,7 @@
|
|||
<literal>IN</literal> predicates performs a check that a particular value is in a list of values.
|
||||
Its syntax is:
|
||||
</para>
|
||||
<programlisting><xi:include href="extras/predicate_in_bnf.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/predicate_in_bnf.txt" parse="text"/></programlisting>
|
||||
<para>
|
||||
The types of the <literal>single_valued_expression</literal> and the individual values in the
|
||||
<literal>single_valued_list</literal> must be consistent. JPQL limits the valid types here
|
||||
|
@ -1285,7 +1284,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>In predicate examples</title>
|
||||
<programlisting><xi:include href="extras/predicate_in_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/predicate_in_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -1306,7 +1305,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Empty collection expression examples</title>
|
||||
<programlisting><xi:include href="extras/empty_collection_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/empty_collection_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -1318,7 +1317,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Member-of collection expression examples</title>
|
||||
<programlisting><xi:include href="extras/member_of_collection_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/member_of_collection_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
@ -1367,7 +1366,7 @@
|
|||
</para>
|
||||
<example id="group_by_illustration">
|
||||
<title>Group-by illustration</title>
|
||||
<programlisting><xi:include href="extras/group_by_illustration.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/group_by_illustration.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The first query retrieves the complete total of all orders. The second retrieves the total for each
|
||||
|
@ -1383,7 +1382,7 @@
|
|||
</para>
|
||||
<example id="having_illustration">
|
||||
<title>Having illustration</title>
|
||||
<programlisting><xi:include href="extras/having_illustration.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/having_illustration.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
The HAVING clause follows the same rules as the WHERE clause and is also made up of predicates. HAVING is
|
||||
|
@ -1432,7 +1431,7 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Order-by examples</title>
|
||||
<programlisting><xi:include href="extras/order_by_example.txt" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting><xi:include href="extras/order_by_example.txt" parse="text"/></programlisting>
|
||||
</example>
|
||||
</section>
|
||||
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<chapter>
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>Services</title>
|
||||
|
||||
<section>
|
||||
|
@ -71,7 +69,7 @@
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="services-registry">
|
||||
<section xml:id="services-registry">
|
||||
<title>ServiceRegistry</title>
|
||||
<para>
|
||||
The central service API, aside from the services themselves, is the
|
||||
|
@ -92,7 +90,7 @@
|
|||
<section>
|
||||
<title>Standard services</title>
|
||||
|
||||
<section id="services-BatchBuilder">
|
||||
<section xml:id="services-BatchBuilder">
|
||||
<title><interfacename>org.hibernate.engine.jdbc.batch.spi.BatchBuilder</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -122,7 +120,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-ConfigurationService">
|
||||
<section xml:id="services-ConfigurationService">
|
||||
<title><interfacename>org.hibernate.service.config.spi.ConfigurationService</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -154,7 +152,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-ConnectionProvider">
|
||||
<section xml:id="services-ConnectionProvider">
|
||||
<title><interfacename>org.hibernate.service.jdbc.connections.spi.ConnectionProvider</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -217,7 +215,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-DialectFactory">
|
||||
<section xml:id="services-DialectFactory">
|
||||
<title><interfacename>org.hibernate.service.jdbc.dialect.spi.DialectFactory</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -250,7 +248,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-DialectResolver">
|
||||
<section xml:id="services-DialectResolver">
|
||||
<title><interfacename>org.hibernate.service.jdbc.dialect.spi.DialectResolver</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -289,7 +287,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-JdbcServices">
|
||||
<section xml:id="services-JdbcServices">
|
||||
<title><interfacename>org.hibernate.engine.jdbc.spi.JdbcServices</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -320,7 +318,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-JmxService">
|
||||
<section xml:id="services-JmxService">
|
||||
<title><interfacename>org.hibernate.service.jmx.spi.JmxService</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -361,7 +359,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-JndiService">
|
||||
<section xml:id="services-JndiService">
|
||||
<title><interfacename>org.hibernate.service.jndi.spi.JndiService</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -391,7 +389,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-JtaPlatform">
|
||||
<section xml:id="services-JtaPlatform">
|
||||
<title><interfacename>org.hibernate.service.jta.platform.spi.JtaPlatform</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -531,7 +529,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-MultiTenantConnectionProvider">
|
||||
<section xml:id="services-MultiTenantConnectionProvider">
|
||||
<title><interfacename>org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -562,7 +560,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-PersisterClassResolver">
|
||||
<section xml:id="services-PersisterClassResolver">
|
||||
<title><interfacename>org.hibernate.persister.spi.PersisterClassResolver</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -595,7 +593,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-PersisterFactory">
|
||||
<section xml:id="services-PersisterFactory">
|
||||
<title><interfacename>org.hibernate.persister.spi.PersisterFactory</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -628,7 +626,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-RegionFactory">
|
||||
<section xml:id="services-RegionFactory">
|
||||
<title><interfacename>org.hibernate.cache.spi.RegionFactory</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -682,7 +680,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-SessionFactoryServiceRegistryFactory">
|
||||
<section xml:id="services-SessionFactoryServiceRegistryFactory">
|
||||
<title><interfacename>org.hibernate.service.spi.SessionFactoryServiceRegistryFactory</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -717,7 +715,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-Statistics">
|
||||
<section xml:id="services-Statistics">
|
||||
<title><interfacename>org.hibernate.stat.Statistics</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -760,7 +758,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-TransactionFactory">
|
||||
<section xml:id="services-TransactionFactory">
|
||||
<title><interfacename>org.hibernate.engine.transaction.spi.TransactionFactory</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -822,7 +820,7 @@
|
|||
</variablelist>
|
||||
</section>
|
||||
|
||||
<section id="services-ImportSqlCommandExtractor">
|
||||
<section xml:id="services-ImportSqlCommandExtractor">
|
||||
<title><interfacename>org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractor</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -910,7 +908,7 @@
|
|||
<section>
|
||||
<title>Special service registries</title>
|
||||
|
||||
<section id="services-registry-bootstrap">
|
||||
<section xml:id="services-registry-bootstrap">
|
||||
<title>Boot-strap registry</title>
|
||||
<para>
|
||||
The boot-strap registry holds services that absolutely have to be available for most things to work.
|
||||
|
@ -924,9 +922,9 @@
|
|||
<classname>org.hibernate.service.BootstrapServiceRegistryBuilder</classname> class.
|
||||
</para>
|
||||
|
||||
<example id="BootstrapServiceRegistryBuilder-example">
|
||||
<example xml:id="BootstrapServiceRegistryBuilder-example">
|
||||
<title>Using BootstrapServiceRegistryBuilder</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/BootstrapServiceRegistryBuilder-example.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
<programlisting role="JAVA"><xi:include href="extras/BootstrapServiceRegistryBuilder-example.java" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
||||
<section id="services-registry-bootstrap-services">
|
||||
|
@ -975,7 +973,7 @@
|
|||
</note>
|
||||
</section>
|
||||
|
||||
<section id="services-IntegratorService">
|
||||
<section xml:id="services-IntegratorService">
|
||||
<title><interfacename>org.hibernate.integrator.spi.IntegratorService</interfacename></title>
|
||||
<para>
|
||||
Applications, add-ons and others all need to integrate with Hibernate which used to require
|
||||
|
@ -1002,7 +1000,7 @@
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="services-registry-sessionfactory">
|
||||
<section xml:id="services-registry-sessionfactory">
|
||||
<title>SessionFactory registry</title>
|
||||
<para>
|
||||
While it is best practice to treat instances of all the registry types as targeting a given
|
||||
|
@ -1013,7 +1011,7 @@
|
|||
<interfacename>org.hibernate.service.spi.SessionFactoryServiceRegistry</interfacename>
|
||||
</para>
|
||||
|
||||
<section id="services-EventListenerRegistry">
|
||||
<section xml:id="services-EventListenerRegistry">
|
||||
<title><interfacename>org.hibernate.event.service.spi.EventListenerRegistry</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -1047,14 +1045,14 @@
|
|||
</section>
|
||||
|
||||
|
||||
<section id="services-use">
|
||||
<section xml:id="services-use">
|
||||
<title>Using services and registries</title>
|
||||
<para>
|
||||
Coming soon...
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="integrators">
|
||||
<section xml:id="integrators">
|
||||
<title>Integrators</title>
|
||||
<para>
|
||||
The <interfacename>org.hibernate.integrator.spi.Integrator</interfacename> is intended to provide a simple
|
||||
|
@ -1081,7 +1079,7 @@
|
|||
See <xref linkend="BootstrapServiceRegistryBuilder-example"/>
|
||||
</para>
|
||||
|
||||
<section id="integrators-uses">
|
||||
<section xml:id="integrators-uses">
|
||||
<title>Integrator use-cases</title>
|
||||
<para>
|
||||
The main use cases for an <interfacename>org.hibernate.integrator.spi.Integrator</interfacename> right
|
||||
|
@ -1091,7 +1089,7 @@
|
|||
relational models.
|
||||
</para>
|
||||
|
||||
<example id="registering-listeners-example">
|
||||
<example xml:id="registering-listeners-example">
|
||||
<title>Registering event listeners</title>
|
||||
<programlisting role="JAVA"><xi:include href="extras/register-event-listeners-example.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text"/></programlisting>
|
||||
</example>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../../Hibernate_Development_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter>
|
||||
|
||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>Transactions and concurrency control</title>
|
||||
|
||||
<section>
|
||||
|
@ -191,21 +190,21 @@
|
|||
<interfacename>org.hibernate.Session</interfacename> acts as a transaction-scoped cache providing
|
||||
repeatable reads for lookup by identifier and queries that result in loading entities.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<important>
|
||||
<para>
|
||||
To reduce lock contention in the database, the physical database transaction needs to be as short as
|
||||
possible. Long database transactions prevent your application from scaling to a highly-concurrent load.
|
||||
Do not hold a database transaction open during end-user-level work, but open it after the end-user-level
|
||||
work is finished. This is concept is referred to as <literal>transactional write-behind</literal>.
|
||||
</para>
|
||||
</important>
|
||||
<important>
|
||||
<para>
|
||||
To reduce lock contention in the database, the physical database transaction needs to be as short as
|
||||
possible. Long database transactions prevent your application from scaling to a highly-concurrent load.
|
||||
Do not hold a database transaction open during end-user-level work, but open it after the end-user-level
|
||||
work is finished. This is concept is referred to as <literal>transactional write-behind</literal>.
|
||||
</para>
|
||||
</important>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Transactional patterns (and anti-patterns)</title>
|
||||
|
||||
<section id="session-per-operation">
|
||||
<section xml:id="session-per-operation">
|
||||
<title>Session-per-operation anti-pattern</title>
|
||||
<para>
|
||||
This is an anti-pattern of opening and closing a <classname>Session</classname> for each database call
|
||||
|
@ -226,7 +225,7 @@
|
|||
</note>
|
||||
</section>
|
||||
|
||||
<section id="session-per-request">
|
||||
<section xml:id="session-per-request">
|
||||
<title>Session-per-request pattern</title>
|
||||
<para>
|
||||
This is the most common transaction pattern. The term request here relates to the concept of a system
|
||||
|
@ -307,7 +306,7 @@
|
|||
</important>
|
||||
</section>
|
||||
|
||||
<section id="long-conversations">
|
||||
<section xml:id="long-conversations">
|
||||
<title>Conversations</title>
|
||||
<para>
|
||||
The <phrase>session-per-request</phrase> pattern is not the only valid way of designing units of work.
|
||||
|
@ -416,6 +415,9 @@
|
|||
|
||||
<section>
|
||||
<title>Session-per-application</title>
|
||||
<para>
|
||||
Discussion coming soon..
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -429,11 +431,11 @@
|
|||
</para>
|
||||
<example>
|
||||
<title>Database identity</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/database-identity.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/database-identity.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>JVM identity</title>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/jvm-identity.java" xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" /></programlisting>
|
||||
<programlisting language="Java" role="JAVA"><xi:include href="extras/jvm-identity.java" parse="text" /></programlisting>
|
||||
</example>
|
||||
<para>
|
||||
For objects attached to a particular <interfacename>Session</interfacename>, the two notions are
|
||||
|
@ -470,7 +472,7 @@
|
|||
</section>
|
||||
|
||||
|
||||
<section id="transactions-basics-issues">
|
||||
<section xml:id="transactions-basics-issues">
|
||||
<title>Common issues</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<bookinfo id="HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java">
|
||||
<title>HIBERNATE - Relational Persistence for Idiomatic Java</title>
|
||||
<subtitle>Hibernate Reference Documentation</subtitle>
|
||||
<releaseinfo>&version;</releaseinfo>
|
||||
<edition>1.0</edition>
|
||||
<pubsnumber>1</pubsnumber>
|
||||
<productname>JBoss Hibernate Core</productname>
|
||||
<productnumber>&version;</productnumber>
|
||||
<pubdate>&today;</pubdate>
|
||||
<issuenum>1</issuenum>
|
||||
<mediaobject>
|
||||
<imageobject role="fo">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" align="center" />
|
||||
</imageobject>
|
||||
<imageobject role="html">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" depth="3cm" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
<copyright>
|
||||
<year>©rightYear;</year>
|
||||
<holder>©rightHolder;</holder>
|
||||
</copyright>
|
||||
<xi:include href="legal_notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="author_group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<!-- Insert relevant fallback material here. Legal_Notice and Author Group is a relevant placement BookInfo.xml-->
|
||||
|
||||
<!-- No legal Notice in Community docs so commenting out -->
|
||||
<!-- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
|
||||
href="Common_Content/Legal_Notice.xml">
|
||||
LEGAL NOTICE INCLUSION FOR JDOCBOOK:
|
||||
<xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:include href="fallback_content/Legal_Notice.xml"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
|
||||
</xi:fallback>
|
||||
</xi:include> -->
|
||||
|
||||
<!--
|
||||
FOR PUBLICAN
|
||||
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
FOR JDOCBOOK
|
||||
<xi:fallback xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
</xi:include>
|
||||
-->
|
||||
|
||||
</bookinfo>
|
|
@ -1,47 +1,17 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!DOCTYPE book SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
|
||||
<!-- old DTD and entity declaration
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY versionNumber "WORKING">
|
||||
<!ENTITY today "TODAY">
|
||||
<!ENTITY copyrightYear "2004">
|
||||
<!ENTITY copyrightHolder "Red Hat Middleware, LLC.">
|
||||
]>
|
||||
-->
|
||||
<book>
|
||||
<!--
|
||||
<bookinfo>
|
||||
<info>
|
||||
<title>HIBERNATE - Relational Persistence for Idiomatic Java</title>
|
||||
<subtitle>Hibernate Reference Documentation</subtitle>
|
||||
<releaseinfo>&versionNumber;</releaseinfo>
|
||||
<productnumber>&versionNumber;</productnumber>
|
||||
<subtitle>Hibernate Reference Documentation</subtitle>
|
||||
<releaseinfo>&version;</releaseinfo>
|
||||
<edition>1.0</edition>
|
||||
<productname>JBoss Hibernate Core</productname>
|
||||
<productnumber>&version;</productnumber>
|
||||
<pubdate>&today;</pubdate>
|
||||
<issuenum>1</issuenum>
|
||||
<mediaobject>
|
||||
|
@ -58,11 +28,8 @@
|
|||
</copyright>
|
||||
<xi:include href="legal_notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="author_group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
</bookinfo>
|
||||
</info>
|
||||
|
||||
<toc/>
|
||||
-->
|
||||
<xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
<xi:include href="content/preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
||||
<xi:include href="content/tutorial.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
|
|
|
@ -1,30 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<chapter id="additionalmodules">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter xml:id="additionalmodules">
|
||||
<title>Additional modules</title>
|
||||
|
||||
<para>Hibernate Core also offers integration with some external
|
||||
|
@ -250,9 +227,10 @@
|
|||
<para>These constraints can be declared directly on the entity
|
||||
properties or indirectly by using constraint composition.</para>
|
||||
|
||||
<para>For more information check the Hibernate Validator <ulink
|
||||
url="http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html/">reference
|
||||
documentation</ulink>.</para>
|
||||
<para>
|
||||
For more information check the Hibernate Validator reference documentation at
|
||||
<link xlink:href="http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html/" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -262,16 +240,16 @@
|
|||
<section>
|
||||
<title>Description</title>
|
||||
|
||||
<para>Full text search engines like <productname>Apache
|
||||
Lucene</productname> are a very powerful technology to bring free
|
||||
text/efficient queries to applications. If suffers several mismatches
|
||||
when dealing with a object domain model (keeping the index up to date,
|
||||
mismatch between the index structure and the domain model, querying
|
||||
mismatch...) Hibernate Search indexes your domain model thanks to a few
|
||||
annotations, takes care of the database / index synchronization and
|
||||
brings you back regular managed objects from free text queries.
|
||||
Hibernate Search is using <ulink url="http://lucene.apache.org">Apache
|
||||
Lucene</ulink> under the cover.</para>
|
||||
<para>
|
||||
Full text search engines like <productname>Apache Lucene</productname> are a very powerful technology to
|
||||
bring free text/efficient queries to applications. If suffers several mismatches when dealing with a
|
||||
object domain model (keeping the index up to date, mismatch between the index structure and the domain
|
||||
model, querying mismatch...) Hibernate Search indexes your domain model thanks to a few annotations,
|
||||
takes care of the database / index synchronization and brings you back regular managed objects from
|
||||
free text queries. Hibernate Search is using
|
||||
<link xlink:href="http://lucene.apache.org" xmlns:xlink="http://www.w3.org/1999/xlink">Apache Lucene</link>
|
||||
under the covers.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
@ -284,9 +262,11 @@
|
|||
<literal>hibernate.search.autoregister_listeners</literal> to false.
|
||||
Such a need is very uncommon and not recommended.</para>
|
||||
|
||||
<para>Check the Hibernate Search <ulink
|
||||
url="http://docs.jboss.org/hibernate/stable/search/reference/en-US/html/">reference
|
||||
documentation</ulink> for more information.</para>
|
||||
<para>
|
||||
Check the Hibernate Search reference documentation (
|
||||
<link xlink:href="http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html/" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
) for more information.
|
||||
</para>
|
||||
</section>
|
||||
</section>
|
||||
</chapter>
|
||||
|
|
|
@ -1,39 +1,11 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="architecture">
|
||||
<chapter xml:id="architecture">
|
||||
|
||||
<title>Architecture</title>
|
||||
|
||||
<section id="architecture-overview">
|
||||
<section xml:id="architecture-overview">
|
||||
<title>Overview</title>
|
||||
|
||||
<para>
|
||||
|
@ -55,7 +27,7 @@
|
|||
illustrate 2 specifically since they are extremes.
|
||||
</para>
|
||||
|
||||
<section id="architecture-overview-minimal">
|
||||
<section xml:id="architecture-overview-minimal">
|
||||
<title>Minimal architecture</title>
|
||||
|
||||
<para>
|
||||
|
@ -73,7 +45,7 @@
|
|||
</mediaobject>
|
||||
</section>
|
||||
|
||||
<section id="architecture-overview-comprehensive">
|
||||
<section xml:id="architecture-overview-comprehensive">
|
||||
<title>Comprehensive architecture</title>
|
||||
|
||||
<para>
|
||||
|
@ -90,7 +62,7 @@
|
|||
</mediaobject>
|
||||
</section>
|
||||
|
||||
<section id="architecture-overview-terms">
|
||||
<section xml:id="architecture-overview-terms">
|
||||
<title>Basic APIs</title>
|
||||
<para>
|
||||
Here are quick discussions about some of the API objects depicted in the preceding diagrams (you will
|
||||
|
@ -196,7 +168,7 @@
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="architecture-jmx" revision="1">
|
||||
<section xml:id="architecture-jmx" revision="1">
|
||||
<title>JMX Integration</title>
|
||||
|
||||
<para>
|
||||
|
@ -211,7 +183,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="architecture-current-session" revision="2">
|
||||
<section xml:id="architecture-current-session" revision="2">
|
||||
<title>Contextual sessions</title>
|
||||
<para>
|
||||
Most applications using Hibernate need some form of "contextual" session, where a given
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="associations">
|
||||
<chapter xml:id="associations">
|
||||
|
||||
<title>Association Mappings</title>
|
||||
|
||||
|
@ -58,10 +30,10 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-unidirectional" revision="1">
|
||||
<section xml:id="assoc-unidirectional" revision="1">
|
||||
<title>Unidirectional associations</title>
|
||||
|
||||
<section id="assoc-unidirectional-m21">
|
||||
<section xml:id="assoc-unidirectional-m21">
|
||||
<title>Many-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -90,7 +62,7 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-unidirectional-121">
|
||||
<section xml:id="assoc-unidirectional-121">
|
||||
<title>One-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -145,7 +117,7 @@ create table Address ( personId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-unidirectional-12m">
|
||||
<section xml:id="assoc-unidirectional-12m">
|
||||
<title>One-to-many</title>
|
||||
|
||||
<para>
|
||||
|
@ -182,10 +154,10 @@ create table Address ( addressId bigint not null primary key, personId bigint no
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-unidirectional-join" revision="1">
|
||||
<section xml:id="assoc-unidirectional-join" revision="1">
|
||||
<title>Unidirectional associations with join tables</title>
|
||||
|
||||
<section id="assoc-unidirectional-join-12m">
|
||||
<section xml:id="assoc-unidirectional-join-12m">
|
||||
<title>One-to-many</title>
|
||||
|
||||
<para>
|
||||
|
@ -219,7 +191,7 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-unidirectional-join-m21">
|
||||
<section xml:id="assoc-unidirectional-join-m21">
|
||||
<title>Many-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -253,7 +225,7 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-unidirectional-join-121">
|
||||
<section xml:id="assoc-unidirectional-join-121">
|
||||
<title>One-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -289,7 +261,7 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-unidirectional-join-m2m">
|
||||
<section xml:id="assoc-unidirectional-join-m2m">
|
||||
<title>Many-to-many</title>
|
||||
|
||||
<para>
|
||||
|
@ -322,10 +294,10 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-bidirectional" revision="1">
|
||||
<section xml:id="assoc-bidirectional" revision="1">
|
||||
<title>Bidirectional associations</title>
|
||||
|
||||
<section id="assoc-bidirectional-m21" revision="2">
|
||||
<section xml:id="assoc-bidirectional-m21" revision="2">
|
||||
<title>one-to-many / many-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -398,7 +370,7 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-bidirectional-121">
|
||||
<section xml:id="assoc-bidirectional-121">
|
||||
<title>One-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -458,10 +430,10 @@ create table Address ( personId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-bidirectional-join" revision="1">
|
||||
<section xml:id="assoc-bidirectional-join" revision="1">
|
||||
<title>Bidirectional associations with join tables</title>
|
||||
|
||||
<section id="assoc-bidirectional-join-12m">
|
||||
<section xml:id="assoc-bidirectional-join-12m">
|
||||
<title>one-to-many / many-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -504,7 +476,7 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-bidirectional-join-121">
|
||||
<section xml:id="assoc-bidirectional-join-121">
|
||||
<title>one to one</title>
|
||||
|
||||
<para>
|
||||
|
@ -550,7 +522,7 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-bidirectional-join-m2m" revision="1">
|
||||
<section xml:id="assoc-bidirectional-join-m2m" revision="1">
|
||||
<title>Many-to-many</title>
|
||||
|
||||
<para>
|
||||
|
@ -589,7 +561,7 @@ create table Address ( addressId bigint not null primary key )
|
|||
|
||||
</section>
|
||||
|
||||
<section id="assoc-complex">
|
||||
<section xml:id="assoc-complex">
|
||||
<title>More complex association mappings</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,36 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="mapping">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter xml:id="mapping">
|
||||
<title>Basic O/R Mapping</title>
|
||||
|
||||
<section id="mapping-declaration" revision="2">
|
||||
<section xml:id="mapping-declaration" revision="2">
|
||||
<title>Mapping declaration</title>
|
||||
|
||||
<para>Object/relational mappings can be defined in three
|
||||
|
@ -210,7 +184,7 @@ public class Dog { ... }</programlisting>
|
|||
affect the database schemas exported by the schema export tool (for
|
||||
example, the <literal> not-null</literal> attribute).</para>
|
||||
|
||||
<section id="mapping-declaration-class" revision="4">
|
||||
<section xml:id="mapping-declaration-class" revision="4">
|
||||
<title>Entity</title>
|
||||
|
||||
<para>An entity is a regular Java object (aka POJO) which will be
|
||||
|
@ -432,47 +406,47 @@ public class Summary {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="class1" />
|
||||
<area coords="2" xml:id="class1" />
|
||||
|
||||
<area coords="3" id="class2" />
|
||||
<area coords="3" xml:id="class2" />
|
||||
|
||||
<area coords="4" id="class3" />
|
||||
<area coords="4" xml:id="class3" />
|
||||
|
||||
<area coords="5" id="class4" />
|
||||
<area coords="5" xml:id="class4" />
|
||||
|
||||
<area coords="6" id="class5" />
|
||||
<area coords="6" xml:id="class5" />
|
||||
|
||||
<area coords="7" id="class6" />
|
||||
<area coords="7" xml:id="class6" />
|
||||
|
||||
<area coords="8" id="class7" />
|
||||
<area coords="8" xml:id="class7" />
|
||||
|
||||
<area coords="9" id="class8" />
|
||||
<area coords="9" xml:id="class8" />
|
||||
|
||||
<area coords="10" id="class9" />
|
||||
<area coords="10" xml:id="class9" />
|
||||
|
||||
<area coords="11" id="class10" />
|
||||
<area coords="11" xml:id="class10" />
|
||||
|
||||
<area coords="12" id="class11" />
|
||||
<area coords="12" xml:id="class11" />
|
||||
|
||||
<area coords="13" id="class12" />
|
||||
<area coords="13" xml:id="class12" />
|
||||
|
||||
<area coords="14" id="class13" />
|
||||
<area coords="14" xml:id="class13" />
|
||||
|
||||
<area coords="15" id="class14" />
|
||||
<area coords="15" xml:id="class14" />
|
||||
|
||||
<area coords="16" id="class15" />
|
||||
<area coords="16" xml:id="class15" />
|
||||
|
||||
<area coords="17" id="class16" />
|
||||
<area coords="17" xml:id="class16" />
|
||||
|
||||
<area coords="18" id="class17" />
|
||||
<area coords="18" xml:id="class17" />
|
||||
|
||||
<area coords="19" id="class18" />
|
||||
<area coords="19" xml:id="class18" />
|
||||
|
||||
<area coords="20" id="class19" />
|
||||
<area coords="20" xml:id="class19" />
|
||||
|
||||
<area coords="21" id="class20" />
|
||||
<area coords="21" xml:id="class20" />
|
||||
|
||||
<area coords="22" id="class21" />
|
||||
<area coords="22" xml:id="class21" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><class
|
||||
|
@ -494,7 +468,7 @@ public class Summary {
|
|||
lazy="true|false"
|
||||
entity-name="EntityName"
|
||||
check="arbitrary sql check condition"
|
||||
rowid="rowid"
|
||||
rowxml:id="rowid"
|
||||
subselect="SQL expression"
|
||||
abstract="true|false"
|
||||
node="element-name"
|
||||
|
@ -670,7 +644,7 @@ public class Summary {
|
|||
attribute and a nested mapping element.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-id" revision="4">
|
||||
<section xml:id="mapping-declaration-id" revision="4">
|
||||
<title>Identifiers</title>
|
||||
|
||||
<para>Mapped classes <emphasis>must</emphasis> declare the primary key
|
||||
|
@ -692,15 +666,15 @@ public class Person {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="id1" />
|
||||
<area coords="2" xml:id="id1" />
|
||||
|
||||
<area coords="3" id="id2" />
|
||||
<area coords="3" xml:id="id2" />
|
||||
|
||||
<area coords="4" id="id3" />
|
||||
<area coords="4" xml:id="id3" />
|
||||
|
||||
<area coords="5" id="id4" />
|
||||
<area coords="5" xml:id="id4" />
|
||||
|
||||
<area coords="6" id="id5" />
|
||||
<area coords="6" xml:id="id5" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><id
|
||||
|
@ -1234,7 +1208,7 @@ class UserId implements Serializable {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-id-generator" revision="2">
|
||||
<section xml:id="mapping-declaration-id-generator" revision="2">
|
||||
<title>Identifier generator</title>
|
||||
|
||||
<para>Hibernate can generate and populate identifier values for you
|
||||
|
@ -1519,7 +1493,7 @@ public String getId() {</programlisting>
|
|||
<term><literal>hilo</literal></term>
|
||||
|
||||
<listitem>
|
||||
<para id="mapping-declaration-id-hilodescription"
|
||||
<para xml:id="mapping-declaration-id-hilodescription"
|
||||
revision="1">uses a hi/lo algorithm to efficiently generate
|
||||
identifiers of type <literal>long</literal>,
|
||||
<literal>short</literal> or <literal>int</literal>, given a
|
||||
|
@ -1611,10 +1585,9 @@ public String getId() {</programlisting>
|
|||
mac address and integrating it via the
|
||||
<interfacename>org.hibernate.id.UUIDGenerationStrategy</interfacename>
|
||||
contract. Two such libraries known at time of this
|
||||
writing include <ulink
|
||||
url="http://johannburkard.de/software/uuid/">http://johannburkard.de/software/uuid/</ulink>
|
||||
and <ulink
|
||||
url="http://commons.apache.org/sandbox/id/uuid.html">http://commons.apache.org/sandbox/id/uuid.html</ulink></para>
|
||||
writing include <link xlink:href="http://johannburkard.de/software/uuid/"/>
|
||||
and <link xlink:href="http://commons.apache.org/sandbox/id/uuid.html"/>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist></para>
|
||||
</listitem>
|
||||
|
@ -1690,7 +1663,7 @@ public String getId() {</programlisting>
|
|||
</variablelist></para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-id-hilo" revision="1">
|
||||
<section xml:id="mapping-declaration-id-hilo" revision="1">
|
||||
<title>Hi/lo algorithm</title>
|
||||
|
||||
<para>The <literal>hilo</literal> and <literal>seqhilo</literal>
|
||||
|
@ -1721,7 +1694,7 @@ public String getId() {</programlisting>
|
|||
<literal>hibernate.transaction.manager_lookup_class</literal>.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-id-uuid">
|
||||
<section xml:id="mapping-declaration-id-uuid">
|
||||
<title>UUID algorithm</title>
|
||||
|
||||
<para>The UUID contains: IP address, startup time of the JVM that is
|
||||
|
@ -1731,7 +1704,7 @@ public String getId() {</programlisting>
|
|||
using JNI.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-id-sequences">
|
||||
<section xml:id="mapping-declaration-id-sequences">
|
||||
<title>Identity columns and sequences</title>
|
||||
|
||||
<para>For databases that support identity columns (DB2, MySQL,
|
||||
|
@ -1759,7 +1732,7 @@ public String getId() {</programlisting>
|
|||
strategies.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-id-assigned">
|
||||
<section xml:id="mapping-declaration-id-assigned">
|
||||
<title>Assigned identifiers</title>
|
||||
|
||||
<para>If you want the application to assign identifiers, as opposed
|
||||
|
@ -1778,7 +1751,7 @@ public String getId() {</programlisting>
|
|||
define <literal>Interceptor.isUnsaved()</literal>.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-id-select">
|
||||
<section xml:id="mapping-declaration-id-select">
|
||||
<title>Primary keys assigned by triggers</title>
|
||||
|
||||
<para>Hibernate does not generate DDL with triggers. It is for
|
||||
|
@ -1846,7 +1819,7 @@ class Person {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-id-enhanced">
|
||||
<section xml:id="mapping-declaration-id-enhanced">
|
||||
<title>Enhanced identifier generators</title>
|
||||
|
||||
<para>Starting with release 3.2.3, there are 2 new generators which
|
||||
|
@ -1982,7 +1955,7 @@ class Person {
|
|||
</listitem>
|
||||
</itemizedlist></para>
|
||||
|
||||
<section id="mapping-declaration-id-enhanced-optimizers">
|
||||
<section xml:id="mapping-declaration-id-enhanced-optimizers">
|
||||
<title>Identifier generator optimization</title>
|
||||
|
||||
<para>For identifier generators that store values in the database,
|
||||
|
@ -2091,7 +2064,7 @@ public class Customer implements Serializable {
|
|||
especially useful for people using assigned identifiers or composite
|
||||
keys</emphasis>.</para>
|
||||
|
||||
<section id="entity-mapping-entity-version">
|
||||
<section xml:id="entity-mapping-entity-version">
|
||||
<title>Version number</title>
|
||||
|
||||
<para>You can add optimistic locking capability to an entity using the
|
||||
|
@ -2128,19 +2101,19 @@ public class Flight implements Serializable {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="version1" />
|
||||
<area coords="2" xml:id="version1" />
|
||||
|
||||
<area coords="3" id="version2" />
|
||||
<area coords="3" xml:id="version2" />
|
||||
|
||||
<area coords="4" id="version3" />
|
||||
<area coords="4" xml:id="version3" />
|
||||
|
||||
<area coords="5" id="version4" />
|
||||
<area coords="5" xml:id="version4" />
|
||||
|
||||
<area coords="6" id="version5" />
|
||||
<area coords="6" xml:id="version5" />
|
||||
|
||||
<area coords="7" id="version6" />
|
||||
<area coords="7" xml:id="version6" />
|
||||
|
||||
<area coords="8" id="version7" />
|
||||
<area coords="8" xml:id="version7" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><version
|
||||
|
@ -2207,7 +2180,7 @@ public class Flight implements Serializable {
|
|||
</programlistingco>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-timestamp" revision="4">
|
||||
<section xml:id="mapping-declaration-timestamp" revision="4">
|
||||
<title>Timestamp</title>
|
||||
|
||||
<para>Alternatively, you can use a timestamp. Timestamps are a less
|
||||
|
@ -2245,17 +2218,17 @@ public class Flight implements Serializable {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="timestamp1" />
|
||||
<area coords="2" xml:id="timestamp1" />
|
||||
|
||||
<area coords="3" id="timestamp2" />
|
||||
<area coords="3" xml:id="timestamp2" />
|
||||
|
||||
<area coords="4" id="timestamp3" />
|
||||
<area coords="4" xml:id="timestamp3" />
|
||||
|
||||
<area coords="5" id="timestamp4" />
|
||||
<area coords="5" xml:id="timestamp4" />
|
||||
|
||||
<area coords="6" id="timestamp5" />
|
||||
<area coords="6" xml:id="timestamp5" />
|
||||
|
||||
<area coords="7" id="timestamp6" />
|
||||
<area coords="7" xml:id="timestamp6" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><timestamp
|
||||
|
@ -2331,7 +2304,7 @@ public class Flight implements Serializable {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-property" revision="4">
|
||||
<section xml:id="mapping-declaration-property" revision="4">
|
||||
<title>Property</title>
|
||||
|
||||
<para>You need to decide which property needs to be made persistent in a
|
||||
|
@ -2678,7 +2651,7 @@ public class Order {
|
|||
require acquisition of the optimistic lock.</para>
|
||||
</section>
|
||||
|
||||
<section id="entity-mapping-property-column">
|
||||
<section xml:id="entity-mapping-property-column">
|
||||
<title>Declaring column attributes</title>
|
||||
|
||||
<para>The column(s) used for a property mapping can be defined using
|
||||
|
@ -2728,25 +2701,25 @@ public String getName() { ... }
|
|||
|
||||
<programlistingco>
|
||||
<areaspec>
|
||||
<area coords="2" id="hm1" />
|
||||
<area coords="2" xml:id="hm1" />
|
||||
|
||||
<area coords="3" id="hm2" />
|
||||
<area coords="3" xml:id="hm2" />
|
||||
|
||||
<area coords="4" id="hm3" />
|
||||
<area coords="4" xml:id="hm3" />
|
||||
|
||||
<area coords="5" id="hm4" />
|
||||
<area coords="5" xml:id="hm4" />
|
||||
|
||||
<area coords="6" id="hm5" />
|
||||
<area coords="6" xml:id="hm5" />
|
||||
|
||||
<area coords="7" id="hm6" />
|
||||
<area coords="7" xml:id="hm6" />
|
||||
|
||||
<area coords="8" id="hm7" />
|
||||
<area coords="8" xml:id="hm7" />
|
||||
|
||||
<area coords="9" id="hm8" />
|
||||
<area coords="9" xml:id="hm8" />
|
||||
|
||||
<area coords="10" id="hm9" />
|
||||
<area coords="10" xml:id="hm9" />
|
||||
|
||||
<area coords="11" id="hm10" />
|
||||
<area coords="11" xml:id="hm10" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting>@Column(
|
||||
|
@ -2801,17 +2774,17 @@ public String getName() { ... }
|
|||
</callout>
|
||||
|
||||
<callout arearefs="hm8">
|
||||
<para><literal><literal>length</literal></literal> (optional):
|
||||
<para><literal>length</literal> (optional):
|
||||
column length (default 255)</para>
|
||||
</callout>
|
||||
|
||||
<callout arearefs="hm8">
|
||||
<para><literal><literal>precision</literal></literal>
|
||||
<para><literal>precision</literal>
|
||||
(optional): column decimal precision (default 0)</para>
|
||||
</callout>
|
||||
|
||||
<callout arearefs="hm10">
|
||||
<para><literal><literal>scale</literal></literal> (optional):
|
||||
<para><literal>scale</literal> (optional):
|
||||
column decimal scale if useful (default 0)</para>
|
||||
</callout>
|
||||
</calloutlist>
|
||||
|
@ -2875,31 +2848,31 @@ public long getObjectVolume()</programlisting>
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="property1" />
|
||||
<area coords="2" xml:id="property1" />
|
||||
|
||||
<area coords="3" id="property2" />
|
||||
<area coords="3" xml:id="property2" />
|
||||
|
||||
<area coords="4" id="property3" />
|
||||
<area coords="4" xml:id="property3" />
|
||||
|
||||
<areaset coords="" id="property4-5">
|
||||
<area coords="5" id="property4" />
|
||||
<areaset coords="" xml:id="property4-5">
|
||||
<area coords="5" xml:id="property4" />
|
||||
|
||||
<area coords="6" id="property5" />
|
||||
<area coords="6" xml:id="property5" />
|
||||
</areaset>
|
||||
|
||||
<area coords="7" id="property6" />
|
||||
<area coords="7" xml:id="property6" />
|
||||
|
||||
<area coords="8" id="property7" />
|
||||
<area coords="8" xml:id="property7" />
|
||||
|
||||
<area coords="9" id="property8" />
|
||||
<area coords="9" xml:id="property8" />
|
||||
|
||||
<area coords="10" id="property9" />
|
||||
<area coords="10" xml:id="property9" />
|
||||
|
||||
<area coords="11" id="property10" />
|
||||
<area coords="11" xml:id="property10" />
|
||||
|
||||
<area coords="12" id="property11" />
|
||||
<area coords="12" xml:id="property11" />
|
||||
|
||||
<area coords="13" id="property12" />
|
||||
<area coords="13" xml:id="property12" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><property
|
||||
|
@ -3065,7 +3038,7 @@ public long getObjectVolume()</programlisting>
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-component">
|
||||
<section xml:id="mapping-declaration-component">
|
||||
<title>Embedded objects (aka components)</title>
|
||||
|
||||
<para>Embeddable objects (or components) are objects whose properties
|
||||
|
@ -3176,21 +3149,21 @@ public class Country implements Serializable {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="component1" />
|
||||
<area coords="2" xml:id="component1" />
|
||||
|
||||
<area coords="3" id="component2" />
|
||||
<area coords="3" xml:id="component2" />
|
||||
|
||||
<area coords="4" id="component3" />
|
||||
<area coords="4" xml:id="component3" />
|
||||
|
||||
<area coords="5" id="component4" />
|
||||
<area coords="5" xml:id="component4" />
|
||||
|
||||
<area coords="6" id="component5" />
|
||||
<area coords="6" xml:id="component5" />
|
||||
|
||||
<area coords="7" id="component6" />
|
||||
<area coords="7" xml:id="component6" />
|
||||
|
||||
<area coords="8" id="component7" />
|
||||
<area coords="8" xml:id="component7" />
|
||||
|
||||
<area coords="9" id="component8" />
|
||||
<area coords="9" xml:id="component8" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><component
|
||||
|
@ -3302,7 +3275,7 @@ public class Country implements Serializable {
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<section id="mapping-declaration-subclass" revision="4">
|
||||
<section xml:id="mapping-declaration-subclass" revision="4">
|
||||
<title>Single table per class hierarchy strategy</title>
|
||||
|
||||
<para>With this approach the properties of all the subclasses in a
|
||||
|
@ -3333,13 +3306,13 @@ public class A320 extends Plane { ... } </programlisting>
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="subclass1" />
|
||||
<area coords="2" xml:id="subclass1" />
|
||||
|
||||
<area coords="3" id="subclass2" />
|
||||
<area coords="3" xml:id="subclass2" />
|
||||
|
||||
<area coords="4" id="subclass3" />
|
||||
<area coords="4" xml:id="subclass3" />
|
||||
|
||||
<area coords="5" id="subclass4" />
|
||||
<area coords="5" xml:id="subclass4" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><subclass
|
||||
|
@ -3386,7 +3359,7 @@ public class A320 extends Plane { ... } </programlisting>
|
|||
<para>For information about inheritance mappings see <xref
|
||||
linkend="inheritance" />.</para>
|
||||
|
||||
<section id="mapping-declaration-discriminator" revision="3">
|
||||
<section xml:id="mapping-declaration-discriminator" revision="3">
|
||||
<title>Discriminator</title>
|
||||
|
||||
<para>Discriminators are required for polymorphic persistence using
|
||||
|
@ -3465,15 +3438,15 @@ public class A320 extends Plane { ... } </programlisting>
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="discriminator1" />
|
||||
<area coords="2" xml:id="discriminator1" />
|
||||
|
||||
<area coords="3" id="discriminator2" />
|
||||
<area coords="3" xml:id="discriminator2" />
|
||||
|
||||
<area coords="4" id="discriminator3" />
|
||||
<area coords="4" xml:id="discriminator3" />
|
||||
|
||||
<area coords="5" id="discriminator4" />
|
||||
<area coords="5" xml:id="discriminator4" />
|
||||
|
||||
<area coords="6" id="discriminator5" />
|
||||
<area coords="6" xml:id="discriminator5" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><discriminator
|
||||
|
@ -3535,7 +3508,7 @@ public class A320 extends Plane { ... } </programlisting>
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-joinedsubclass" revision="3">
|
||||
<section xml:id="mapping-declaration-joinedsubclass" revision="3">
|
||||
<title>Joined subclass strategy</title>
|
||||
|
||||
<para>Each subclass can also be mapped to its own table. This is
|
||||
|
@ -3577,13 +3550,13 @@ public class DomesticCat extends Cat {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="joinedsubclass1" />
|
||||
<area coords="2" xml:id="joinedsubclass1" />
|
||||
|
||||
<area coords="3" id="joinedsubclass2" />
|
||||
<area coords="3" xml:id="joinedsubclass2" />
|
||||
|
||||
<area coords="4" id="joinedsubclass3" />
|
||||
<area coords="4" xml:id="joinedsubclass3" />
|
||||
|
||||
<area coords="5" id="joinedsubclass4" />
|
||||
<area coords="5" xml:id="joinedsubclass4" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><joined-subclass
|
||||
|
@ -3672,7 +3645,7 @@ public class DomesticCat extends Cat {
|
|||
linkend="inheritance" />.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-unionsubclass" revision="2">
|
||||
<section xml:id="mapping-declaration-unionsubclass" revision="2">
|
||||
<title>Table per class strategy</title>
|
||||
|
||||
<para>A third option is to map only the concrete classes of an
|
||||
|
@ -3692,13 +3665,13 @@ public class Flight implements Serializable { ... } </programlisting>
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="unionsubclass1" />
|
||||
<area coords="2" xml:id="unionsubclass1" />
|
||||
|
||||
<area coords="3" id="unionsubclass2" />
|
||||
<area coords="3" xml:id="unionsubclass2" />
|
||||
|
||||
<area coords="4" id="unionsubclass3" />
|
||||
<area coords="4" xml:id="unionsubclass3" />
|
||||
|
||||
<area coords="5" id="unionsubclass4" />
|
||||
<area coords="5" xml:id="unionsubclass4" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><union-subclass
|
||||
|
@ -3862,7 +3835,7 @@ public class Plane extends FlyingObject {
|
|||
inherit them.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-join" revision="3">
|
||||
<section xml:id="mapping-declaration-join" revision="3">
|
||||
<title>Mapping one entity to several tables</title>
|
||||
|
||||
<para>While not recommended for a fresh schema, some legacy databases
|
||||
|
@ -3997,17 +3970,17 @@ public class Cat implements Serializable {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="join1" />
|
||||
<area coords="2" xml:id="join1" />
|
||||
|
||||
<area coords="3" id="join2" />
|
||||
<area coords="3" xml:id="join2" />
|
||||
|
||||
<area coords="4" id="join3" />
|
||||
<area coords="4" xml:id="join3" />
|
||||
|
||||
<area coords="5" id="join4" />
|
||||
<area coords="5" xml:id="join4" />
|
||||
|
||||
<area coords="6" id="join5" />
|
||||
<area coords="6" xml:id="join5" />
|
||||
|
||||
<area coords="7" id="join6" />
|
||||
<area coords="7" xml:id="join6" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><join
|
||||
|
@ -4163,7 +4136,7 @@ public class Cat implements Serializable {
|
|||
overrides any lazy attribute (an association loaded through a
|
||||
<literal>JOIN</literal> strategy cannot be lazy).</para>
|
||||
|
||||
<section id="mapping-declaration-manytoone" revision="5">
|
||||
<section xml:id="mapping-declaration-manytoone" revision="5">
|
||||
<title>Using a foreign key or an association table</title>
|
||||
|
||||
<para>An ordinary association to another persistent class is declared
|
||||
|
@ -4352,39 +4325,39 @@ class Home {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="manytoone1" />
|
||||
<area coords="2" xml:id="manytoone1" />
|
||||
|
||||
<area coords="3" id="manytoone2" />
|
||||
<area coords="3" xml:id="manytoone2" />
|
||||
|
||||
<area coords="4" id="manytoone3" />
|
||||
<area coords="4" xml:id="manytoone3" />
|
||||
|
||||
<area coords="5" id="manytoone4" />
|
||||
<area coords="5" xml:id="manytoone4" />
|
||||
|
||||
<area coords="6" id="manytoone5" />
|
||||
<area coords="6" xml:id="manytoone5" />
|
||||
|
||||
<areaset coords="" id="manytoone6-7">
|
||||
<area coords="7" id="manytoone6" />
|
||||
<areaset coords="" xml:id="manytoone6-7">
|
||||
<area coords="7" xml:id="manytoone6" />
|
||||
|
||||
<area coords="8" id="manytoone7" />
|
||||
<area coords="8" xml:id="manytoone7" />
|
||||
</areaset>
|
||||
|
||||
<area coords="9" id="manytoone8" />
|
||||
<area coords="9" xml:id="manytoone8" />
|
||||
|
||||
<area coords="10" id="manytoone9" />
|
||||
<area coords="10" xml:id="manytoone9" />
|
||||
|
||||
<area coords="11" id="manytoone10" />
|
||||
<area coords="11" xml:id="manytoone10" />
|
||||
|
||||
<area coords="12" id="manytoone11" />
|
||||
<area coords="12" xml:id="manytoone11" />
|
||||
|
||||
<area coords="13" id="manytoone12" />
|
||||
<area coords="13" xml:id="manytoone12" />
|
||||
|
||||
<area coords="14" id="manytoone13" />
|
||||
<area coords="14" xml:id="manytoone13" />
|
||||
|
||||
<area coords="15" id="manytoone14" />
|
||||
<area coords="15" xml:id="manytoone14" />
|
||||
|
||||
<area coords="16" id="manytoone15" />
|
||||
<area coords="16" xml:id="manytoone15" />
|
||||
|
||||
<area coords="17" id="manytoone16" />
|
||||
<area coords="17" xml:id="manytoone16" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><many-to-one
|
||||
|
@ -4562,7 +4535,7 @@ class Home {
|
|||
<programlisting role="XML"><many-to-one name="owner" property-ref="identity.ssn" column="OWNER_SSN"/></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-onetoone" revision="3">
|
||||
<section xml:id="mapping-declaration-onetoone" revision="3">
|
||||
<title>Sharing the primary key with the associated entity</title>
|
||||
|
||||
<para>The second approach is to ensure an entity and its associated
|
||||
|
@ -4605,25 +4578,25 @@ public class Heart {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="onetoone1" />
|
||||
<area coords="2" xml:id="onetoone1" />
|
||||
|
||||
<area coords="3" id="onetoone2" />
|
||||
<area coords="3" xml:id="onetoone2" />
|
||||
|
||||
<area coords="4" id="onetoone3" />
|
||||
<area coords="4" xml:id="onetoone3" />
|
||||
|
||||
<area coords="5" id="onetoone4" />
|
||||
<area coords="5" xml:id="onetoone4" />
|
||||
|
||||
<area coords="6" id="onetoone5" />
|
||||
<area coords="6" xml:id="onetoone5" />
|
||||
|
||||
<area coords="7" id="onetoone6" />
|
||||
<area coords="7" xml:id="onetoone6" />
|
||||
|
||||
<area coords="8" id="onetoone7" />
|
||||
<area coords="8" xml:id="onetoone7" />
|
||||
|
||||
<area coords="9" id="onetoone8" />
|
||||
<area coords="9" xml:id="onetoone8" />
|
||||
|
||||
<area coords="10" id="onetoone9" />
|
||||
<area coords="10" xml:id="onetoone9" />
|
||||
|
||||
<area coords="11" id="onetoone10" />
|
||||
<area coords="11" xml:id="onetoone10" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><one-to-one
|
||||
|
@ -4754,7 +4727,7 @@ public class Heart {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-naturalid">
|
||||
<section xml:id="mapping-declaration-naturalid">
|
||||
<title>Natural-id</title>
|
||||
|
||||
<para>Although we recommend the use of surrogate keys as primary keys,
|
||||
|
@ -4814,7 +4787,7 @@ List results = s.createCriteria( Citizen.class )
|
|||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<section id="mapping-types-anymapping" revision="2">
|
||||
<section xml:id="mapping-types-anymapping" revision="2">
|
||||
<title>Any</title>
|
||||
|
||||
<para>There is one more type of property mapping. The
|
||||
|
@ -4889,17 +4862,17 @@ package org.hibernate.test.annotations.any;
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="any1" />
|
||||
<area coords="2" xml:id="any1" />
|
||||
|
||||
<area coords="3" id="any2" />
|
||||
<area coords="3" xml:id="any2" />
|
||||
|
||||
<area coords="4" id="any3" />
|
||||
<area coords="4" xml:id="any3" />
|
||||
|
||||
<area coords="5" id="any4" />
|
||||
<area coords="5" xml:id="any4" />
|
||||
|
||||
<area coords="6" id="any5" />
|
||||
<area coords="6" xml:id="any5" />
|
||||
|
||||
<area coords="7" id="any6" />
|
||||
<area coords="7" xml:id="any6" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><any
|
||||
|
@ -4955,7 +4928,7 @@ package org.hibernate.test.annotations.any;
|
|||
</programlistingco>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-properties" revision="2">
|
||||
<section xml:id="mapping-declaration-properties" revision="2">
|
||||
<title>Properties</title>
|
||||
|
||||
<para>The <literal><properties></literal> element allows the
|
||||
|
@ -4967,15 +4940,15 @@ package org.hibernate.test.annotations.any;
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="properties1" />
|
||||
<area coords="2" xml:id="properties1" />
|
||||
|
||||
<area coords="3" id="properties2" />
|
||||
<area coords="3" xml:id="properties2" />
|
||||
|
||||
<area coords="4" id="properties3" />
|
||||
<area coords="4" xml:id="properties3" />
|
||||
|
||||
<area coords="5" id="properties4" />
|
||||
<area coords="5" xml:id="properties4" />
|
||||
|
||||
<area coords="6" id="properties5" />
|
||||
<area coords="6" xml:id="properties5" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><properties
|
||||
|
@ -5085,7 +5058,7 @@ class Home {
|
|||
<para>The hbm.xml structure has some specificities naturally not present
|
||||
when using annotations, let's describe them briefly.</para>
|
||||
|
||||
<section id="mapping-declaration-doctype" revision="3">
|
||||
<section xml:id="mapping-declaration-doctype" revision="3">
|
||||
<title>Doctype</title>
|
||||
|
||||
<para>All XML mappings should declare the doctype shown. The actual
|
||||
|
@ -5096,7 +5069,7 @@ class Home {
|
|||
an Internet connection, check the DTD declaration against the contents
|
||||
of your classpath.</para>
|
||||
|
||||
<section id="mapping-declaration-entity-resolution">
|
||||
<section xml:id="mapping-declaration-entity-resolution">
|
||||
<title>EntityResolver</title>
|
||||
|
||||
<para>Hibernate will first attempt to resolve DTDs in its classpath.
|
||||
|
@ -5139,7 +5112,7 @@ class Home {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-mapping" revision="3">
|
||||
<section xml:id="mapping-declaration-mapping" revision="3">
|
||||
<title>Hibernate-mapping</title>
|
||||
|
||||
<para>This element has several optional attributes. The
|
||||
|
@ -5156,19 +5129,19 @@ class Home {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="hm1" />
|
||||
<area coords="2" xml:id="hm1" />
|
||||
|
||||
<area coords="3" id="hm2" />
|
||||
<area coords="3" xml:id="hm2" />
|
||||
|
||||
<area coords="4" id="hm3" />
|
||||
<area coords="4" xml:id="hm3" />
|
||||
|
||||
<area coords="5" id="hm4" />
|
||||
<area coords="5" xml:id="hm4" />
|
||||
|
||||
<area coords="6" id="hm5" />
|
||||
<area coords="6" xml:id="hm5" />
|
||||
|
||||
<area coords="7" id="hm6" />
|
||||
<area coords="7" xml:id="hm6" />
|
||||
|
||||
<area coords="8" id="hm7" />
|
||||
<area coords="8" xml:id="hm7" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><hibernate-mapping
|
||||
|
@ -5241,8 +5214,8 @@ class Home {
|
|||
<literal>Animal.hbm.xml</literal>.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-key">
|
||||
<title id="section.key">Key</title>
|
||||
<section xml:id="mapping-declaration-key">
|
||||
<title xml:id="section.key">Key</title>
|
||||
|
||||
<para>The <literal><key></literal> element is featured a few
|
||||
times within this guide. It appears anywhere the parent mapping
|
||||
|
@ -5252,17 +5225,17 @@ class Home {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="key1" />
|
||||
<area coords="2" xml:id="key1" />
|
||||
|
||||
<area coords="3" id="key2" />
|
||||
<area coords="3" xml:id="key2" />
|
||||
|
||||
<area coords="4" id="key3" />
|
||||
<area coords="4" xml:id="key3" />
|
||||
|
||||
<area coords="5" id="key4" />
|
||||
<area coords="5" xml:id="key4" />
|
||||
|
||||
<area coords="6" id="key5" />
|
||||
<area coords="6" xml:id="key5" />
|
||||
|
||||
<area coords="7" id="key6" />
|
||||
<area coords="7" xml:id="key6" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><key
|
||||
|
@ -5329,7 +5302,7 @@ class Home {
|
|||
not-null="true"></literal>.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-declaration-import">
|
||||
<section xml:id="mapping-declaration-import">
|
||||
<title>Import</title>
|
||||
|
||||
<para>If your application has two persistent classes with the same
|
||||
|
@ -5342,9 +5315,9 @@ class Home {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="import1" />
|
||||
<area coords="2" xml:id="import1" />
|
||||
|
||||
<area coords="3" id="import2" />
|
||||
<area coords="3" xml:id="import2" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><import
|
||||
|
@ -5372,7 +5345,7 @@ class Home {
|
|||
</note>
|
||||
</section>
|
||||
|
||||
<section id="mapping-column" revision="5">
|
||||
<section xml:id="mapping-column" revision="5">
|
||||
<title>Column and formula elements</title>
|
||||
|
||||
<para>Mapping elements which accept a <literal>column</literal>
|
||||
|
@ -5419,10 +5392,10 @@ class Home {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-types">
|
||||
<section xml:id="mapping-types">
|
||||
<title>Hibernate types</title>
|
||||
|
||||
<section id="mapping-types-entitiesvalues" revision="1">
|
||||
<section xml:id="mapping-types-entitiesvalues" revision="1">
|
||||
<title>Entities and values</title>
|
||||
|
||||
<para>In relation to the persistence service, Java language-level
|
||||
|
@ -5481,7 +5454,7 @@ class Home {
|
|||
support null semantics.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-types-basictypes" revision="4">
|
||||
<section xml:id="mapping-types-basictypes" revision="4">
|
||||
<title>Basic value types</title>
|
||||
|
||||
<para>The built-in <emphasis>basic mapping types</emphasis> can be
|
||||
|
@ -5673,7 +5646,7 @@ class Home {
|
|||
<literal>string</literal> type.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-types-custom" revision="2">
|
||||
<section xml:id="mapping-types-custom" revision="2">
|
||||
<title>Custom value types</title>
|
||||
|
||||
<para>It is relatively easy for developers to create their own value
|
||||
|
@ -5753,7 +5726,7 @@ class Home {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="mapping-entityname">
|
||||
<section xml:id="mapping-entityname">
|
||||
<title>Mapping a class more than once</title>
|
||||
|
||||
<para>It is possible to provide more than one mapping for a particular
|
||||
|
@ -5790,7 +5763,7 @@ class Home {
|
|||
</note>
|
||||
</section>
|
||||
|
||||
<section id="mapping-quotedidentifiers">
|
||||
<section xml:id="mapping-quotedidentifiers">
|
||||
<title>SQL quoted identifiers</title>
|
||||
|
||||
<para>You can force Hibernate to quote an identifier in the generated SQL
|
||||
|
@ -5812,7 +5785,7 @@ class LineItem {
|
|||
</class></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="mapping-generated" revision="1">
|
||||
<section xml:id="mapping-generated" revision="1">
|
||||
<title>Generated properties</title>
|
||||
|
||||
<para>Generated properties are properties that have their values generated
|
||||
|
@ -5848,7 +5821,7 @@ class LineItem {
|
|||
<classname>@Generated</classname>.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-column-read-and-write" revision="1">
|
||||
<section xml:id="mapping-column-read-and-write" revision="1">
|
||||
<title>Column transformers: read and write expressions</title>
|
||||
|
||||
<para>Hibernate allows you to customize the SQL it uses to read and write
|
||||
|
@ -5920,7 +5893,7 @@ class User {
|
|||
exactly one '?' placeholder for the value.</para>
|
||||
</section>
|
||||
|
||||
<section id="mapping-database-object">
|
||||
<section xml:id="mapping-database-object">
|
||||
<title>Auxiliary database objects</title>
|
||||
|
||||
<para>Auxiliary database objects allow for the CREATE and DROP of
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="batch">
|
||||
<chapter xml:id="batch">
|
||||
<title>Batch processing</title>
|
||||
|
||||
<para>
|
||||
|
@ -62,7 +34,7 @@ session.close();]]></programlisting>
|
|||
|
||||
<programlisting><![CDATA[hibernate.jdbc.batch_size 20]]></programlisting>
|
||||
|
||||
<para id="disablebatching" revision="1">
|
||||
<para xml:id="disablebatching" revision="1">
|
||||
Hibernate disables insert batching at the JDBC level transparently if you
|
||||
use an <literal>identity</literal> identifier generator.
|
||||
</para>
|
||||
|
@ -79,7 +51,7 @@ session.close();]]></programlisting>
|
|||
<literal>CacheMode</literal> to disable interaction with the second-level cache.
|
||||
</para>
|
||||
|
||||
<section id="batch-inserts">
|
||||
<section xml:id="batch-inserts">
|
||||
<title>Batch inserts</title>
|
||||
|
||||
<para>
|
||||
|
@ -106,7 +78,7 @@ session.close();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="batch-update" >
|
||||
<section xml:id="batch-update" >
|
||||
<title>Batch updates</title>
|
||||
|
||||
<para>
|
||||
|
@ -137,7 +109,7 @@ session.close();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="batch-statelesssession">
|
||||
<section xml:id="batch-statelesssession">
|
||||
<title>The StatelessSession interface</title>
|
||||
<para>
|
||||
Alternatively, Hibernate provides a command-oriented API that can be used for
|
||||
|
@ -186,7 +158,7 @@ session.close();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="batch-direct" revision="3">
|
||||
<section xml:id="batch-direct" revision="3">
|
||||
<title>DML-style operations</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="best-practices" revision="3">
|
||||
<chapter xml:id="best-practices" revision="3">
|
||||
<title>Best Practices</title>
|
||||
|
||||
<variablelist spacing="compact">
|
||||
|
|
|
@ -1,44 +1,19 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
<!DOCTYPE bibliography SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<bibliography>
|
||||
<title>References</title>
|
||||
|
||||
<biblioentry id="biblio-PoEAA">
|
||||
<biblioentry xml:id="biblio-PoEAA">
|
||||
<abbrev>PoEAA</abbrev>
|
||||
<title>Patterns of Enterprise Application Architecture</title>
|
||||
<isbn>0-321-12742-0</isbn>
|
||||
<biblioid class="isbn">0-321-12742-0</biblioid>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Martin</firstname>
|
||||
<surname>Fowler</surname>
|
||||
<personname>
|
||||
<firstname>Martin</firstname>
|
||||
<surname>Fowler</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<copyright>
|
||||
|
@ -50,22 +25,26 @@
|
|||
</publisher>
|
||||
</biblioentry>
|
||||
|
||||
<biblioentry id="biblio-JPwH">
|
||||
<biblioentry xml:id="biblio-JPwH">
|
||||
<abbrev>JPwH</abbrev>
|
||||
<title>Java Persistence with Hibernate</title>
|
||||
<subtitle>Second Edition of Hibernate in Action</subtitle>
|
||||
<isbn>1-932394-88-5</isbn>
|
||||
<biblioid class="isbn">1-932394-88-5</biblioid>
|
||||
<bibliomisc>
|
||||
<ulink url="http://www.manning.com/bauer2"/>
|
||||
<link xlink:href="http://www.manning.com/bauer2" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
</bibliomisc>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Christian</firstname>
|
||||
<surname>Bauer</surname>
|
||||
<personname>
|
||||
<firstname>Christian</firstname>
|
||||
<surname>Bauer</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Gavin</firstname>
|
||||
<surname>King</surname>
|
||||
<personname>
|
||||
<firstname>Gavin</firstname>
|
||||
<surname>King</surname>
|
||||
</personname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<copyright>
|
||||
|
|
|
@ -1,36 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="collections">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter xml:id="collections">
|
||||
<title>Collection mapping</title>
|
||||
|
||||
<section id="collections-persistent" revision="3">
|
||||
<section xml:id="collections-persistent" revision="3">
|
||||
<title>Persistent collections</title>
|
||||
|
||||
<para>Naturally Hibernate also allows to persist collections. These
|
||||
|
@ -102,7 +76,7 @@ kittens = cat.getKittens(); // Okay, kittens collection is a Set
|
|||
</note>
|
||||
</section>
|
||||
|
||||
<section id="collections-mapping" revision="4">
|
||||
<section xml:id="collections-mapping" revision="4">
|
||||
<title>How to map collections</title>
|
||||
|
||||
<para>Using annotations you can map <classname>Collection</classname>s,
|
||||
|
@ -112,7 +86,7 @@ kittens = cat.getKittens(); // Okay, kittens collection is a Set
|
|||
@ElementCollection. In the simplest case a collection mapping looks like
|
||||
this:</para>
|
||||
|
||||
<example id="example.collection.mapping.annotations">
|
||||
<example xml:id="example.collection.mapping.annotations">
|
||||
<title>Collection mapping using @OneToMany and @JoinColumn</title>
|
||||
|
||||
<programlisting role="JAVA">@Entity
|
||||
|
@ -143,9 +117,8 @@ public class Part {
|
|||
also use a join table as seen in <xref
|
||||
linkend="example-one-to-many-with-join-table" />.</para>
|
||||
|
||||
<example id="example-one-to-many-with-join-table">
|
||||
<title id="example-one-to-many-with-join-table">Collection mapping using
|
||||
@OneToMany and @JoinTable</title>
|
||||
<example xml:id="example-one-to-many-with-join-table">
|
||||
<title>Collection mapping using @OneToMany and @JoinTable</title>
|
||||
|
||||
<programlisting role="JAVA">@Entity
|
||||
public class Product {
|
||||
|
@ -191,7 +164,7 @@ public class Part {
|
|||
<literal><set></literal> element is used for mapping properties of
|
||||
type <literal>Set</literal>.</para>
|
||||
|
||||
<example floatstyle="" id="example.collections.set">
|
||||
<example floatstyle="" xml:id="example.collections.set">
|
||||
<title>Mapping a Set using <set></title>
|
||||
|
||||
<programlisting role="JAVA"><class name="Product">
|
||||
|
@ -230,11 +203,11 @@ public class Part {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="onetomany1" />
|
||||
<area coords="2" xml:id="onetomany1" />
|
||||
|
||||
<area coords="3" id="onetomany2" />
|
||||
<area coords="3" xml:id="onetomany2" />
|
||||
|
||||
<area coords="4" id="onetomany3" />
|
||||
<area coords="4" xml:id="onetomany3" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><one-to-many
|
||||
|
@ -295,33 +268,33 @@ public class Part {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="mappingcollection1" />
|
||||
<area coords="2" xml:id="mappingcollection1" />
|
||||
|
||||
<area coords="3" id="mappingcollection2" />
|
||||
<area coords="3" xml:id="mappingcollection2" />
|
||||
|
||||
<area coords="4" id="mappingcollection3" />
|
||||
<area coords="4" xml:id="mappingcollection3" />
|
||||
|
||||
<area coords="5" id="mappingcollection4" />
|
||||
<area coords="5" xml:id="mappingcollection4" />
|
||||
|
||||
<area coords="6" id="mappingcollection5" />
|
||||
<area coords="6" xml:id="mappingcollection5" />
|
||||
|
||||
<area coords="7" id="mappingcollection6" />
|
||||
<area coords="7" xml:id="mappingcollection6" />
|
||||
|
||||
<area coords="8" id="mappingcollection7" />
|
||||
<area coords="8" xml:id="mappingcollection7" />
|
||||
|
||||
<area coords="9" id="mappingcollection8" />
|
||||
<area coords="9" xml:id="mappingcollection8" />
|
||||
|
||||
<area coords="10" id="mappingcollection9" />
|
||||
<area coords="10" xml:id="mappingcollection9" />
|
||||
|
||||
<area coords="11" id="mappingcollection10" />
|
||||
<area coords="11" xml:id="mappingcollection10" />
|
||||
|
||||
<area coords="12" id="mappingcollection11" />
|
||||
<area coords="12" xml:id="mappingcollection11" />
|
||||
|
||||
<area coords="13" id="mappingcollection12" />
|
||||
<area coords="13" xml:id="mappingcollection12" />
|
||||
|
||||
<area coords="14" id="mappingcollection13" />
|
||||
<area coords="14" xml:id="mappingcollection13" />
|
||||
|
||||
<area coords="15" id="mappingcollection14" />
|
||||
<area coords="15" xml:id="mappingcollection14" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><map
|
||||
|
@ -448,7 +421,7 @@ public class Part {
|
|||
paragraphs we will now focus details like physical mapping considerations,
|
||||
indexed collections and collections of value types.</para>
|
||||
|
||||
<section id="collections-foreignkeys">
|
||||
<section xml:id="collections-foreignkeys">
|
||||
<title>Collection foreign keys</title>
|
||||
|
||||
<para>On the database level collection instances are distinguished by
|
||||
|
@ -479,12 +452,12 @@ public class Part {
|
|||
|
||||
<programlisting role="Java">@OnDelete(action=OnDeleteAction.CASCADE)</programlisting>
|
||||
|
||||
<para>See <xref lang="" linkend="section.key" /> for more information
|
||||
<para>See <xref linkend="section.key" /> for more information
|
||||
about the <literal><key></literal> element.</para>
|
||||
</section>
|
||||
|
||||
<section id="collections-indexed">
|
||||
<title id="section.indexed.collections">Indexed collections</title>
|
||||
<section xml:id="collections-indexed">
|
||||
<title xml:id="section.indexed.collections">Indexed collections</title>
|
||||
|
||||
<para>In the following paragraphs we have a closer at the indexed
|
||||
collections <classname>List</classname> and <classname>Map</classname>
|
||||
|
@ -633,9 +606,9 @@ public class Order {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="index1" />
|
||||
<area coords="2" xml:id="index1" />
|
||||
|
||||
<area coords="3" id="index2" />
|
||||
<area coords="3" xml:id="index2" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><list-index
|
||||
|
@ -825,11 +798,11 @@ public class Order {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="mapkey1" />
|
||||
<area coords="2" xml:id="mapkey1" />
|
||||
|
||||
<area coords="3" id="mapkey2" />
|
||||
<area coords="3" xml:id="mapkey2" />
|
||||
|
||||
<area coords="4" id="mapkey3" />
|
||||
<area coords="4" xml:id="mapkey3" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><map-key
|
||||
|
@ -863,11 +836,11 @@ public class Order {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="indexmanytomany1" />
|
||||
<area coords="2" xml:id="indexmanytomany1" />
|
||||
|
||||
<area coords="3" id="indexmanytomany2" />
|
||||
<area coords="3" xml:id="indexmanytomany2" />
|
||||
|
||||
<area coords="3" id="indexmanytomany3" />
|
||||
<area coords="3" xml:id="indexmanytomany3" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><map-key-many-to-many
|
||||
|
@ -897,7 +870,7 @@ public class Order {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="collections-ofvalues" revision="2">
|
||||
<section xml:id="collections-ofvalues" revision="2">
|
||||
<title>Collections of basic types and embeddable objects</title>
|
||||
|
||||
<para>In some situations you don't need to associate two entities but
|
||||
|
@ -996,11 +969,11 @@ public class User {
|
|||
|
||||
<programlistingco role="XML">
|
||||
<areaspec>
|
||||
<area coords="2" id="element1b" />
|
||||
<area coords="2" xml:id="element1b" />
|
||||
|
||||
<area coords="3" id="element2b" />
|
||||
<area coords="3" xml:id="element2b" />
|
||||
|
||||
<area coords="4" id="element3b" />
|
||||
<area coords="4" xml:id="element3b" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><element
|
||||
|
@ -1036,11 +1009,11 @@ public class User {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="collections-advancedmappings">
|
||||
<section xml:id="collections-advancedmappings">
|
||||
<title>Advanced collection mappings</title>
|
||||
|
||||
<section id="collections-sorted" revision="2">
|
||||
<title id="section.sorted.collections">Sorted collections</title>
|
||||
<section xml:id="collections-sorted" revision="2">
|
||||
<title xml:id="section.sorted.collections">Sorted collections</title>
|
||||
|
||||
<para>Hibernate supports collections implementing
|
||||
<literal>java.util.SortedMap</literal> and
|
||||
|
@ -1132,7 +1105,7 @@ public SortedSet<Ticket> getTickets() {
|
|||
</example>
|
||||
</section>
|
||||
|
||||
<section id="collections-bidirectional" revision="1">
|
||||
<section xml:id="collections-bidirectional" revision="1">
|
||||
<title>Bidirectional associations</title>
|
||||
|
||||
<para>A <emphasis>bidirectional association</emphasis> allows navigation
|
||||
|
@ -1379,7 +1352,7 @@ public class Customer {
|
|||
category can have many items and each item can be in many
|
||||
categories:</para>
|
||||
|
||||
<example id="example-many-to-many-mapping-file">
|
||||
<example xml:id="example-many-to-many-mapping-file">
|
||||
<title>Many to many association using Hibernate mapping files</title>
|
||||
|
||||
<programlisting role="XML"><class name="Category">
|
||||
|
@ -1425,7 +1398,7 @@ session.persist(category); // The relationship will be saved</prog
|
|||
to the database.</para>
|
||||
</section>
|
||||
|
||||
<section id="collections-indexedbidirectional">
|
||||
<section xml:id="collections-indexedbidirectional">
|
||||
<title>Bidirectional associations with indexed collections</title>
|
||||
|
||||
<para>There are some additional considerations for bidirectional
|
||||
|
@ -1500,7 +1473,7 @@ session.persist(category); // The relationship will be saved</prog
|
|||
association is responsible for updates to the foreign key.<!--TODO: Does this really result in some unnecessary update statements?--></para>
|
||||
</section>
|
||||
|
||||
<section id="collections-ternary">
|
||||
<section xml:id="collections-ternary">
|
||||
<title>Ternary associations</title>
|
||||
|
||||
<para>There are three possible approaches to mapping a ternary
|
||||
|
@ -1534,7 +1507,7 @@ public class Company {
|
|||
composite elements, which will be discussed later.</para>
|
||||
</section>
|
||||
|
||||
<section id="collections-idbag" revision="1">
|
||||
<section xml:id="collections-idbag" revision="1">
|
||||
<title><literal>Using an <idbag></literal></title>
|
||||
|
||||
<para>The majority of the many-to-many associations and collections of
|
||||
|
@ -1576,7 +1549,7 @@ public class Company {
|
|||
|
||||
<!--undocumenting this stuff -->
|
||||
|
||||
<!--section id="collections-heterogeneous">
|
||||
<!--section xml:id="collections-heterogeneous">
|
||||
<title>Heterogeneous Associations</title>
|
||||
|
||||
<para>
|
||||
|
@ -1588,7 +1561,7 @@ public class Company {
|
|||
|
||||
</section-->
|
||||
|
||||
<section id="collections-example" revision="1">
|
||||
<section xml:id="collections-example" revision="1">
|
||||
<title>Collection examples</title>
|
||||
|
||||
<para>This section covers collection examples.</para>
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="components">
|
||||
<chapter xml:id="components">
|
||||
<title>Component Mapping</title>
|
||||
|
||||
<para>
|
||||
|
@ -37,7 +9,7 @@
|
|||
throughout Hibernate.
|
||||
</para>
|
||||
|
||||
<section id="components-dependentobjects" revision="2" >
|
||||
<section xml:id="components-dependentobjects" revision="2" >
|
||||
<title>Dependent objects</title>
|
||||
|
||||
<para>
|
||||
|
@ -163,7 +135,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="components-incollections" revision="1">
|
||||
<section xml:id="components-incollections" revision="1">
|
||||
<title>Collections of dependent objects</title>
|
||||
|
||||
<para>
|
||||
|
@ -264,7 +236,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="components-asmapindex">
|
||||
<section xml:id="components-asmapindex">
|
||||
<title>Components as Map indices</title>
|
||||
|
||||
<para>
|
||||
|
@ -275,7 +247,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="components-compositeid" revision="1">
|
||||
<section xml:id="components-compositeid" revision="1">
|
||||
<title>Components as composite identifiers</title>
|
||||
|
||||
<para>
|
||||
|
@ -415,7 +387,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="components-dynamic" revision="1">
|
||||
<section xml:id="components-dynamic" revision="1">
|
||||
<title>Dynamic components</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,33 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="session-configuration" revision="1">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter xml:id="session-configuration" revision="1">
|
||||
<title>Configuration</title>
|
||||
|
||||
<para>Hibernate is designed to operate in many different environments and,
|
||||
|
@ -37,7 +11,7 @@
|
|||
<literal>etc/</literal> that displays the various options. Simply put the
|
||||
example file in your classpath and customize it to suit your needs.</para>
|
||||
|
||||
<section id="configuration-programmatic" revision="1">
|
||||
<section xml:id="configuration-programmatic" revision="1">
|
||||
<title>Programmatic configuration</title>
|
||||
|
||||
<para>An instance of
|
||||
|
@ -114,7 +88,7 @@
|
|||
<literal>SessionFactory</literal> is created.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-sessionfactory">
|
||||
<section xml:id="configuration-sessionfactory">
|
||||
<title>Obtaining a SessionFactory</title>
|
||||
|
||||
<para>When all mappings have been parsed by the
|
||||
|
@ -130,7 +104,7 @@
|
|||
useful if you are using more than one database.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-hibernatejdbc" revision="1">
|
||||
<section xml:id="configuration-hibernatejdbc" revision="1">
|
||||
<title>JDBC connections</title>
|
||||
|
||||
<para>It is advisable to have the
|
||||
|
@ -320,7 +294,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
<property>hibernate.connection.provider_class</property> property.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-optional" revision="1">
|
||||
<section xml:id="configuration-optional" revision="1">
|
||||
<title>Optional configuration properties</title>
|
||||
|
||||
<para>There are a number of other properties that control the behavior of
|
||||
|
@ -336,7 +310,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
above.</para>
|
||||
</warning></para>
|
||||
|
||||
<table frame="topbot" id="configuration-optional-properties" revision="8">
|
||||
<table frame="topbot" xml:id="configuration-optional-properties" revision="8">
|
||||
<title>Hibernate Configuration Properties</title>
|
||||
|
||||
<tgroup cols="2">
|
||||
|
@ -503,7 +477,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
databases (if a sequence or a table is used for id generation).</para>
|
||||
</note>
|
||||
|
||||
<table frame="topbot" id="configuration-jdbc-properties" revision="8">
|
||||
<table frame="topbot" xml:id="configuration-jdbc-properties" revision="8">
|
||||
<title>Hibernate JDBC and Connection Properties</title>
|
||||
|
||||
<tgroup cols="2">
|
||||
|
@ -666,7 +640,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
</tgroup>
|
||||
</table>
|
||||
|
||||
<table frame="topbot" id="configuration-cache-properties" revision="7">
|
||||
<table frame="topbot" xml:id="configuration-cache-properties" revision="7">
|
||||
<title>Hibernate Cache Properties</title>
|
||||
|
||||
<tgroup cols="2">
|
||||
|
@ -761,7 +735,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
</tgroup>
|
||||
</table>
|
||||
|
||||
<table frame="topbot" id="configuration-transaction-properties"
|
||||
<table frame="topbot" xml:id="configuration-transaction-properties"
|
||||
revision="9">
|
||||
<title>Hibernate Transaction Properties</title>
|
||||
|
||||
|
@ -835,7 +809,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
</tgroup>
|
||||
</table>
|
||||
|
||||
<table frame="topbot" id="configuration-misc-properties" revision="11">
|
||||
<table frame="topbot" xml:id="configuration-misc-properties" revision="11">
|
||||
<title>Miscellaneous Properties</title>
|
||||
|
||||
<tgroup cols="2">
|
||||
|
@ -955,7 +929,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
</tgroup>
|
||||
</table>
|
||||
|
||||
<section id="configuration-optional-dialects" revision="1">
|
||||
<section xml:id="configuration-optional-dialects" revision="1">
|
||||
<title>SQL Dialects</title>
|
||||
|
||||
<para>Always set the <literal>hibernate.dialect</literal> property to
|
||||
|
@ -964,7 +938,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
defaults for some of the other properties listed above. This means that
|
||||
you will not have to specify them manually.</para>
|
||||
|
||||
<table frame="topbot" id="sql-dialects" revision="3">
|
||||
<table frame="topbot" xml:id="sql-dialects" revision="3">
|
||||
<title>Hibernate SQL Dialects
|
||||
(<literal>hibernate.dialect</literal>)</title>
|
||||
|
||||
|
@ -1149,7 +1123,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
</table>
|
||||
</section>
|
||||
|
||||
<section id="configuration-optional-outerjoin" revision="4">
|
||||
<section xml:id="configuration-optional-outerjoin" revision="4">
|
||||
<title>Outer Join Fetching</title>
|
||||
|
||||
<para>If your database supports ANSI, Oracle or Sybase style outer
|
||||
|
@ -1171,7 +1145,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
information.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-optional-binarystreams" revision="1">
|
||||
<section xml:id="configuration-optional-binarystreams" revision="1">
|
||||
<title>Binary Streams</title>
|
||||
|
||||
<para>Oracle limits the size of <literal>byte</literal> arrays that can
|
||||
|
@ -1182,7 +1156,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
is a system-level setting only.</emphasis></para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-optional-cacheprovider" revision="2">
|
||||
<section xml:id="configuration-optional-cacheprovider" revision="2">
|
||||
<title>Second-level and query cache</title>
|
||||
|
||||
<para>The properties prefixed by <literal>hibernate.cache</literal>
|
||||
|
@ -1191,7 +1165,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
information.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-optional-querysubstitution">
|
||||
<section xml:id="configuration-optional-querysubstitution">
|
||||
<title>Query Language Substitution</title>
|
||||
|
||||
<para>You can define new Hibernate query tokens using
|
||||
|
@ -1209,7 +1183,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
function.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-optional-statistics" revision="2">
|
||||
<section xml:id="configuration-optional-statistics" revision="2">
|
||||
<title>Hibernate statistics</title>
|
||||
|
||||
<para>If you enable <literal>hibernate.generate_statistics</literal>,
|
||||
|
@ -1221,18 +1195,26 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="configuration-logging">
|
||||
<section xml:id="configuration-logging">
|
||||
<title>Logging</title>
|
||||
|
||||
<para>Hibernate utilizes <ulink url="http://www.slf4j.org/">Simple Logging
|
||||
Facade for Java</ulink> (SLF4J) in order to log various system events.
|
||||
<important>
|
||||
<para>
|
||||
Completely out of date. Hibernate uses JBoss Logging starting in 4.0.
|
||||
This will get documented as we migrate this content to the Developer Guide.
|
||||
</para>
|
||||
</important>
|
||||
|
||||
<para>Hibernate utilizes <link xlink:href="http://www.slf4j.org/" xmlns:xlink="http://www.w3.org/1999/xlink">Simple Logging
|
||||
Facade for Java</link> (SLF4J) in order to log various system events.
|
||||
SLF4J can direct your logging output to several logging frameworks (NOP,
|
||||
Simple, log4j version 1.2, JDK 1.4 logging, JCL or logback) depending on
|
||||
your chosen binding. In order to setup logging you will need
|
||||
<filename>slf4j-api.jar</filename> in your classpath together with the jar
|
||||
file for your preferred binding - <filename>slf4j-log4j12.jar</filename>
|
||||
in the case of Log4J. See the SLF4J <ulink
|
||||
url="http://www.slf4j.org/manual.html">documentation</ulink> for more
|
||||
in the case of Log4J. See the SLF4J
|
||||
<link xlink:href="http://www.slf4j.org/manual.html" xmlns:xlink="http://www.w3.org/1999/xlink">documentation</link>
|
||||
for more
|
||||
detail. To use Log4j you will also need to place a
|
||||
<filename>log4j.properties</filename> file in your classpath. An example
|
||||
properties file is distributed with Hibernate in the
|
||||
|
@ -1244,7 +1226,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
troubleshooting device. The most interesting log categories are the
|
||||
following:</para>
|
||||
|
||||
<table frame="topbot" id="log-categories" revision="2">
|
||||
<table frame="topbot" xml:id="log-categories" revision="2">
|
||||
<title>Hibernate Log Categories</title>
|
||||
|
||||
<tgroup cols="2">
|
||||
|
@ -1332,7 +1314,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
<literal>hibernate.show_sql</literal> enabled.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-namingstrategy">
|
||||
<section xml:id="configuration-namingstrategy">
|
||||
<title>Implementing a <literal>NamingStrategy</literal></title>
|
||||
|
||||
<para>The interface <literal>org.hibernate.cfg.NamingStrategy</literal>
|
||||
|
@ -1403,7 +1385,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
them on each entity or collection mapping. </para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-xmlconfig" revision="2">
|
||||
<section xml:id="configuration-xmlconfig" revision="2">
|
||||
<title>XML configuration file</title>
|
||||
|
||||
<para>An alternative approach to configuration is to specify a full
|
||||
|
@ -1467,7 +1449,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
.buildSessionFactory();</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="configuration-j2ee" revision="1">
|
||||
<section xml:id="configuration-j2ee" revision="1">
|
||||
<title>Java EE Application Server integration</title>
|
||||
|
||||
<para>Hibernate has the following integration points for J2EE
|
||||
|
@ -1524,7 +1506,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
<literal>hibernate.connection.aggressive_release</literal> to true if your
|
||||
application server shows "connection containment" exceptions.</para>
|
||||
|
||||
<section id="configuration-optional-transactionstrategy" revision="3">
|
||||
<section xml:id="configuration-optional-transactionstrategy" revision="3">
|
||||
<title>Transaction strategy configuration</title>
|
||||
|
||||
<para>The Hibernate <literal>Session</literal> API is independent of any
|
||||
|
@ -1584,7 +1566,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
you have to specify how Hibernate should obtain a reference to the
|
||||
<literal>TransactionManager</literal>:</para>
|
||||
|
||||
<table frame="topbot" id="jtamanagerlookup" revision="1">
|
||||
<table frame="topbot" xml:id="jtamanagerlookup" revision="1">
|
||||
<title>JTA TransactionManagers</title>
|
||||
|
||||
<tgroup cols="2">
|
||||
|
@ -1673,7 +1655,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
</table>
|
||||
</section>
|
||||
|
||||
<section id="configuration-optional-jndi" revision="3">
|
||||
<section xml:id="configuration-optional-jndi" revision="3">
|
||||
<title>JNDI-bound <literal>SessionFactory</literal></title>
|
||||
|
||||
<para>A JNDI-bound Hibernate <literal>SessionFactory</literal> can
|
||||
|
@ -1718,7 +1700,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
chapter 1.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-j2ee-currentsession" revision="4">
|
||||
<section xml:id="configuration-j2ee-currentsession" revision="4">
|
||||
<title>Current Session context management with JTA</title>
|
||||
|
||||
<para>The easiest way to handle <literal>Sessions</literal> and
|
||||
|
@ -1743,7 +1725,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
|||
transaction demarcation with CMT is preferred.</para>
|
||||
</section>
|
||||
|
||||
<section id="configuration-j2ee-jmx" revision="1">
|
||||
<section xml:id="configuration-j2ee-jmx" revision="1">
|
||||
<title>JMX deployment</title>
|
||||
|
||||
<para>The line <literal>cfg.buildSessionFactory()</literal> still has to
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="events">
|
||||
<chapter xml:id="events">
|
||||
<title>Interceptors and events</title>
|
||||
|
||||
<para>
|
||||
|
@ -38,7 +10,7 @@
|
|||
functionality and the extension of Hibernate functionality.
|
||||
</para>
|
||||
|
||||
<section id="objectstate-interceptors" revision="3">
|
||||
<section xml:id="objectstate-interceptors" revision="3">
|
||||
<title>Interceptors</title>
|
||||
|
||||
<para>
|
||||
|
@ -165,7 +137,7 @@ public class AuditInterceptor extends EmptyInterceptor {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="objectstate-events" revision="4">
|
||||
<section xml:id="objectstate-events" revision="4">
|
||||
<title>Event system</title>
|
||||
|
||||
<para>
|
||||
|
@ -219,7 +191,7 @@ public class AuditInterceptor extends EmptyInterceptor {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="objectstate-decl-security" revision="2">
|
||||
<section xml:id="objectstate-decl-security" revision="2">
|
||||
<title>Hibernate declarative security</title>
|
||||
<para>
|
||||
Usually, declarative security in Hibernate applications is managed in a session facade
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="example-mappings">
|
||||
<chapter xml:id="example-mappings">
|
||||
<title>Example: Various Mappings</title>
|
||||
|
||||
|
||||
|
@ -37,7 +9,7 @@
|
|||
This chapters explores some more complex association mappings.
|
||||
</para>
|
||||
|
||||
<section id="example-mappings-emp">
|
||||
<section xml:id="example-mappings-emp">
|
||||
<title>Employer/Employee</title>
|
||||
|
||||
<para>
|
||||
|
@ -150,7 +122,7 @@ create sequence employer_id_seq]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="example-mappings-authorwork">
|
||||
<section xml:id="example-mappings-authorwork">
|
||||
<title>Author/Work</title>
|
||||
|
||||
<para>
|
||||
|
@ -272,7 +244,7 @@ alter table author_work
|
|||
|
||||
</section>
|
||||
|
||||
<section id="example-mappings-customerorderproduct">
|
||||
<section xml:id="example-mappings-customerorderproduct">
|
||||
<title>Customer/Order/Product</title>
|
||||
|
||||
<para>
|
||||
|
@ -380,7 +352,7 @@ alter table line_items
|
|||
|
||||
</section>
|
||||
|
||||
<section id="misc">
|
||||
<section xml:id="misc">
|
||||
<title>Miscellaneous example mappings</title>
|
||||
|
||||
<para>
|
||||
|
@ -391,7 +363,7 @@ alter table line_items
|
|||
|
||||
<!-- <<para>TODO: put words around this stuff</para>-->
|
||||
|
||||
<section id="example-mappings-typed-onetone">
|
||||
<section xml:id="example-mappings-typed-onetone">
|
||||
<title>"Typed" one-to-one association</title>
|
||||
<programlisting role="XML"><![CDATA[<class name="Person">
|
||||
<id name="name"/>
|
||||
|
@ -421,7 +393,7 @@ alter table line_items
|
|||
</class>]]></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="example-mappings-composite-key">
|
||||
<section xml:id="example-mappings-composite-key">
|
||||
<title>Composite key example</title>
|
||||
<programlisting role="XML"><![CDATA[<class name="Customer">
|
||||
|
||||
|
@ -538,7 +510,7 @@ alter table line_items
|
|||
</class>]]></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="example-mappings-composite-key-manytomany">
|
||||
<section xml:id="example-mappings-composite-key-manytomany">
|
||||
<title>Many-to-many with shared composite key attribute</title>
|
||||
<programlisting role="XML"><![CDATA[<class name="User" table="`User`">
|
||||
<composite-id>
|
||||
|
@ -577,7 +549,7 @@ alter table line_items
|
|||
]]></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="example-mappings-content-discrimination">
|
||||
<section xml:id="example-mappings-content-discrimination">
|
||||
<title>Content based discrimination</title>
|
||||
<programlisting role="XML"><![CDATA[<class name="Person"
|
||||
discriminator-value="P">
|
||||
|
@ -631,7 +603,7 @@ alter table line_items
|
|||
</class>]]></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="example-mappings-association-alternatekeys" revision="2">
|
||||
<section xml:id="example-mappings-association-alternatekeys" revision="2">
|
||||
<title>Associations on alternate keys</title>
|
||||
<programlisting role="XML"><![CDATA[<class name="Person">
|
||||
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="example-parentchild">
|
||||
<chapter xml:id="example-parentchild">
|
||||
<title>Example: Parent/Child</title>
|
||||
|
||||
<para>
|
||||
|
@ -45,7 +17,7 @@
|
|||
|
||||
</para>
|
||||
|
||||
<section id="example-parentchild-collections">
|
||||
<section xml:id="example-parentchild-collections">
|
||||
<title>A note about collections</title>
|
||||
|
||||
<para>
|
||||
|
@ -88,7 +60,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="example-parentchild-bidir">
|
||||
<section xml:id="example-parentchild-bidir">
|
||||
<title>Bidirectional one-to-many</title>
|
||||
|
||||
<para>
|
||||
|
@ -201,7 +173,7 @@ session.flush();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="example-parentchild-cascades">
|
||||
<section xml:id="example-parentchild-cascades">
|
||||
<title>Cascading life cycle</title>
|
||||
|
||||
<para>
|
||||
|
@ -274,7 +246,7 @@ session.flush();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="example-parentchild-update">
|
||||
<section xml:id="example-parentchild-update">
|
||||
<title>Cascades and <literal>unsaved-value</literal></title>
|
||||
|
||||
<para>
|
||||
|
@ -312,7 +284,7 @@ session.flush();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="example-parentchild-conclusion">
|
||||
<section xml:id="example-parentchild-conclusion">
|
||||
<title>Conclusion</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,38 +1,10 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="example-weblog">
|
||||
<chapter xml:id="example-weblog">
|
||||
<title>Example: Weblog Application</title>
|
||||
|
||||
<section id="example-weblog-classes">
|
||||
<section xml:id="example-weblog-classes">
|
||||
<title>Persistent Classes</title>
|
||||
|
||||
<para>
|
||||
|
@ -116,7 +88,7 @@ public class BlogItem {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="example-weblog-mappings">
|
||||
<section xml:id="example-weblog-mappings">
|
||||
<title>Hibernate Mappings</title>
|
||||
|
||||
<para>
|
||||
|
@ -209,7 +181,7 @@ public class BlogItem {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="example-weblog-code">
|
||||
<section xml:id="example-weblog-code">
|
||||
<title>Hibernate Code</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,33 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="filters">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter xml:id="filters">
|
||||
<title>Filtering data</title>
|
||||
|
||||
<para>Hibernate3 provides an innovative new approach to handling data with
|
||||
|
@ -35,7 +9,7 @@
|
|||
named, parameterized filter that can be enabled or disabled for a particular
|
||||
Hibernate session.</para>
|
||||
|
||||
<section id="objectstate-filters" revision="1">
|
||||
<section xml:id="objectstate-filters" revision="1">
|
||||
<title>Hibernate filters</title>
|
||||
|
||||
<para>Hibernate3 has the ability to pre-define filter criteria and attach
|
||||
|
|
|
@ -1,38 +1,10 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="inheritance">
|
||||
<chapter xml:id="inheritance">
|
||||
<title>Inheritance mapping</title>
|
||||
|
||||
<section id="inheritance-strategies" revision="3">
|
||||
<section xml:id="inheritance-strategies" revision="3">
|
||||
<title>The three strategies</title>
|
||||
|
||||
<para>
|
||||
|
@ -103,7 +75,7 @@
|
|||
</hibernate-mapping>]]></programlisting>
|
||||
|
||||
|
||||
<section id="inheritance-tableperclass" >
|
||||
<section xml:id="inheritance-tableperclass" >
|
||||
<title>Table per class hierarchy</title>
|
||||
|
||||
<para>
|
||||
|
@ -140,7 +112,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="inheritance-tablepersubclass">
|
||||
<section xml:id="inheritance-tablepersubclass">
|
||||
<title>Table per subclass</title>
|
||||
|
||||
<para>
|
||||
|
@ -176,7 +148,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="inheritance-tablepersubclass-discriminator" revision="2">
|
||||
<section xml:id="inheritance-tablepersubclass-discriminator" revision="2">
|
||||
<title>Table per subclass: using a discriminator</title>
|
||||
|
||||
<para>
|
||||
|
@ -227,7 +199,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="inheritance-mixing-tableperclass-tablepersubclass">
|
||||
<section xml:id="inheritance-mixing-tableperclass-tablepersubclass">
|
||||
<title>Mixing table per class hierarchy with table per subclass</title>
|
||||
|
||||
<para>
|
||||
|
@ -266,7 +238,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="inheritance-tableperconcrete" revision="2">
|
||||
<section xml:id="inheritance-tableperconcrete" revision="2">
|
||||
<title>Table per concrete class</title>
|
||||
|
||||
<para>
|
||||
|
@ -315,7 +287,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="inheritance-tableperconcreate-polymorphism">
|
||||
<section xml:id="inheritance-tableperconcreate-polymorphism">
|
||||
<title>Table per concrete class using implicit polymorphism</title>
|
||||
|
||||
<para>
|
||||
|
@ -353,7 +325,7 @@
|
|||
using XML entities
|
||||
(for example, <literal>[ <!ENTITY allproperties SYSTEM "allproperties.xml"> ]</literal>
|
||||
in the <literal>DOCTYPE</literal> declaration and
|
||||
<literal>&allproperties;</literal> in the mapping).
|
||||
<literal><![CDATA[%allproperties;]]></literal> in the mapping).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -376,7 +348,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="inheritance-mixingpolymorphism">
|
||||
<section xml:id="inheritance-mixingpolymorphism">
|
||||
<title>Mixing implicit polymorphism with other inheritance mappings</title>
|
||||
|
||||
<para>
|
||||
|
@ -429,7 +401,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="inheritance-limitations">
|
||||
<section xml:id="inheritance-limitations">
|
||||
<title>Limitations</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,36 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="performance">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter xml:id="performance">
|
||||
<title>Improving performance</title>
|
||||
|
||||
<section id="performance-fetching" revision="2">
|
||||
<section xml:id="performance-fetching" revision="2">
|
||||
<title>Fetching strategies</title>
|
||||
|
||||
<para>Hibernate uses a <emphasis>fetching strategy</emphasis> to retrieve
|
||||
|
@ -128,7 +102,7 @@
|
|||
for what data is always available in any detached instance of a particular
|
||||
class.</para>
|
||||
|
||||
<section id="performance-fetching-lazy">
|
||||
<section xml:id="performance-fetching-lazy">
|
||||
<title>Working with lazy associations</title>
|
||||
|
||||
<para>By default, Hibernate3 uses lazy select fetching for collections
|
||||
|
@ -176,7 +150,7 @@ Integer accessLevel = (Integer) permissions.get("accounts"); // Error!</program
|
|||
associations and collections.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-fetching-custom" revision="4">
|
||||
<section xml:id="performance-fetching-custom" revision="4">
|
||||
<title>Tuning fetch strategies</title>
|
||||
|
||||
<para>Select fetching (the default) is extremely vulnerable to N+1
|
||||
|
@ -243,7 +217,7 @@ Integer accessLevel = (Integer) permissions.get("accounts"); // Error!</program
|
|||
use the second-level cache.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-fetching-proxies" revision="2">
|
||||
<section xml:id="performance-fetching-proxies" revision="2">
|
||||
<title>Single-ended association proxies</title>
|
||||
|
||||
<para>Lazy fetching for collections is implemented using Hibernate's own
|
||||
|
@ -371,7 +345,7 @@ Cat fritz = (Cat) iter.next();</programlisting>
|
|||
initialization.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-fetching-initialization" revision="1">
|
||||
<section xml:id="performance-fetching-initialization" revision="1">
|
||||
<title>Initializing collections and proxies</title>
|
||||
|
||||
<para>A <literal>LazyInitializationException</literal> will be thrown by
|
||||
|
@ -460,7 +434,7 @@ Cat fritz = (Cat) iter.next();</programlisting>
|
|||
<programlisting role="JAVA">s.createFilter( lazyCollection, "").setFirstResult(0).setMaxResults(10).list();</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="performance-fetching-batch">
|
||||
<section xml:id="performance-fetching-batch">
|
||||
<title>Using batch fetching</title>
|
||||
|
||||
<para>Using batch fetching, Hibernate can load several uninitialized
|
||||
|
@ -512,7 +486,7 @@ Cat fritz = (Cat) iter.next();</programlisting>
|
|||
path</emphasis> might be a better option for read-mostly trees.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-fetching-subselect">
|
||||
<section xml:id="performance-fetching-subselect">
|
||||
<title>Using subselect fetching</title>
|
||||
|
||||
<para>If one lazy collection or single-valued proxy has to be fetched,
|
||||
|
@ -523,7 +497,7 @@ Cat fritz = (Cat) iter.next();</programlisting>
|
|||
<!-- TODO: Write more about this -->
|
||||
</section>
|
||||
|
||||
<section id="performance-fetching-profiles">
|
||||
<section xml:id="performance-fetching-profiles">
|
||||
<title>Fetch profiles</title>
|
||||
|
||||
<para>Another way to affect the fetching strategy for loading associated
|
||||
|
@ -640,13 +614,14 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
|
|||
<classname>@FetchProfiles</classname> can be used.</para>
|
||||
</note>
|
||||
|
||||
<para>Currently only join style fetch profiles are supported, but they
|
||||
plan is to support additional styles. See <ulink
|
||||
url="http://opensource.atlassian.com/projects/hibernate/browse/HHH-3414">HHH-3414</ulink>
|
||||
for details.</para>
|
||||
<para>
|
||||
Currently only join style fetch profiles are supported, but they plan is to support additional styles. See
|
||||
<link xlink:href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-3414" xmlns:xlink="http://www.w3.org/1999/xlink">HHH-3414</link>
|
||||
for details.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-fetching-lazyproperties">
|
||||
<section xml:id="performance-fetching-lazyproperties">
|
||||
<title>Using lazy property fetching</title>
|
||||
|
||||
<para>Hibernate3 supports the lazy fetching of individual properties.
|
||||
|
@ -679,7 +654,7 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
|
|||
<taskdef name="instrument" classname="org.hibernate.tool.instrument.InstrumentTask">
|
||||
<classpath path="${jar.path}"/>
|
||||
<classpath path="${classes.dir}"/>
|
||||
<classpath refid="lib.class.path"/>
|
||||
<classpath refxml:id="lib.class.path"/>
|
||||
</taskdef>
|
||||
|
||||
<instrument verbose="true">
|
||||
|
@ -699,7 +674,7 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="performance-cache" revision="1">
|
||||
<section xml:id="performance-cache" revision="1">
|
||||
<title>The Second Level Cache</title>
|
||||
|
||||
<para>A Hibernate <literal>Session</literal> is a transaction-level cache
|
||||
|
@ -720,7 +695,7 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
|
|||
versions prior to Hibernate 3.2 use EhCache as the default cache
|
||||
provider.</para>
|
||||
|
||||
<table frame="topbot" id="cacheproviders" revision="1">
|
||||
<table frame="topbot" xml:id="cacheproviders" revision="1">
|
||||
<title>Cache Providers</title>
|
||||
|
||||
<tgroup align="left" cols="5" colsep="1" rowsep="1">
|
||||
|
@ -835,7 +810,7 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
|
|||
</tgroup>
|
||||
</table>
|
||||
|
||||
<section id="performance-cache-mapping" revision="2">
|
||||
<section xml:id="performance-cache-mapping" revision="2">
|
||||
<title>Cache mappings</title>
|
||||
|
||||
<para>As we have done in previous chapters we are looking at the two
|
||||
|
@ -903,7 +878,7 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
|
|||
that.</para>
|
||||
</note>
|
||||
|
||||
<example id="example-cache-concurrency-with-cache-annotation">
|
||||
<example xml:id="example-cache-concurrency-with-cache-annotation">
|
||||
<title>Definition of cache concurrency strategy via
|
||||
<classname>@Cache</classname></title>
|
||||
|
||||
|
@ -934,17 +909,17 @@ public SortedSet<Ticket> getTickets() {
|
|||
its attributes. It allows you to define the caching strategy and region
|
||||
of a given second level cache.</para>
|
||||
|
||||
<example id="example-cache-annotation-with-attributes">
|
||||
<example xml:id="example-cache-annotation-with-attributes">
|
||||
<title><classname>@Cache</classname> annotation with
|
||||
attributes</title>
|
||||
|
||||
<programlistingco>
|
||||
<areaspec>
|
||||
<area coords="2" id="cache-hm1" />
|
||||
<area coords="2" xml:id="cache-hm1" />
|
||||
|
||||
<area coords="3" id="cache-hm2" />
|
||||
<area coords="3" xml:id="cache-hm2" />
|
||||
|
||||
<area coords="4" id="cache-hm3" />
|
||||
<area coords="4" xml:id="cache-hm3" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting>@Cache(
|
||||
|
@ -980,17 +955,17 @@ public SortedSet<Ticket> getTickets() {
|
|||
linkend="example-hibernate-cache-mapping-element" /> the parallels to
|
||||
anotations is obvious.</para>
|
||||
|
||||
<example id="example-hibernate-cache-mapping-element">
|
||||
<example xml:id="example-hibernate-cache-mapping-element">
|
||||
<title>The Hibernate <literal><cache></literal> mapping
|
||||
element</title>
|
||||
|
||||
<programlistingco>
|
||||
<areaspec>
|
||||
<area coords="2" id="cache1" />
|
||||
<area coords="2" xml:id="cache1" />
|
||||
|
||||
<area coords="3" id="cache2" />
|
||||
<area coords="3" xml:id="cache2" />
|
||||
|
||||
<area coords="4" id="cache3" />
|
||||
<area coords="4" xml:id="cache3" />
|
||||
</areaspec>
|
||||
|
||||
<programlisting><cache
|
||||
|
@ -1034,7 +1009,7 @@ public SortedSet<Ticket> getTickets() {
|
|||
strategies</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-cache-readonly">
|
||||
<section xml:id="performance-cache-readonly">
|
||||
<title>Strategy: read only</title>
|
||||
|
||||
<para>If your application needs to read, but not modify, instances of a
|
||||
|
@ -1043,7 +1018,7 @@ public SortedSet<Ticket> getTickets() {
|
|||
in a cluster.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-cache-readwrite">
|
||||
<section xml:id="performance-cache-readwrite">
|
||||
<title>Strategy: read/write</title>
|
||||
|
||||
<para>If the application needs to update data, a
|
||||
|
@ -1061,7 +1036,7 @@ public SortedSet<Ticket> getTickets() {
|
|||
<emphasis>do not</emphasis> support locking.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-cache-nonstrict">
|
||||
<section xml:id="performance-cache-nonstrict">
|
||||
<title>Strategy: nonstrict read/write</title>
|
||||
|
||||
<para>If the application only occasionally needs to update data (i.e. if
|
||||
|
@ -1075,7 +1050,7 @@ public SortedSet<Ticket> getTickets() {
|
|||
<literal>Session.disconnect()</literal> is called.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-cache-transactional">
|
||||
<section xml:id="performance-cache-transactional">
|
||||
<title>Strategy: transactional</title>
|
||||
|
||||
<para>The <literal>transactional</literal> cache strategy provides
|
||||
|
@ -1084,7 +1059,7 @@ public SortedSet<Ticket> getTickets() {
|
|||
<literal>hibernate.transaction.manager_lookup_class</literal>.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-cache-compat-matrix">
|
||||
<section xml:id="performance-cache-compat-matrix">
|
||||
<title>Cache-provider/concurrency-strategy compatibility</title>
|
||||
|
||||
<important>
|
||||
|
@ -1212,7 +1187,7 @@ public SortedSet<Ticket> getTickets() {
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="performance-sessioncache" revision="2">
|
||||
<section xml:id="performance-sessioncache" revision="2">
|
||||
<title>Managing the caches</title>
|
||||
|
||||
<para>Whenever you pass an object to <literal>save()</literal>,
|
||||
|
@ -1316,13 +1291,13 @@ hibernate.cache.use_structured_entries true</programlisting>
|
|||
</example>
|
||||
</section>
|
||||
|
||||
<section id="performance-querycache" revision="1">
|
||||
<section xml:id="performance-querycache" revision="1">
|
||||
<title>The Query Cache</title>
|
||||
|
||||
<para>Query result sets can also be cached. This is only useful for
|
||||
queries that are run frequently with the same parameters.</para>
|
||||
|
||||
<section id="performance-querycache-enable">
|
||||
<section xml:id="performance-querycache-enable">
|
||||
<title>Enabling query caching</title>
|
||||
|
||||
<para>Caching of query results introduces some overhead in terms of your
|
||||
|
@ -1377,7 +1352,7 @@ hibernate.cache.use_structured_entries true</programlisting>
|
|||
</note>
|
||||
</section>
|
||||
|
||||
<section id="performance-querycache-regions">
|
||||
<section xml:id="performance-querycache-regions">
|
||||
<title>Query cache regions</title>
|
||||
|
||||
<para>If you require fine-grained control over query cache expiration
|
||||
|
@ -1403,14 +1378,14 @@ hibernate.cache.use_structured_entries true</programlisting>
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="performance-collections">
|
||||
<section xml:id="performance-collections">
|
||||
<title>Understanding Collection performance</title>
|
||||
|
||||
<para>In the previous sections we have covered collections and their
|
||||
applications. In this section we explore some more issues in relation to
|
||||
collections at runtime.</para>
|
||||
|
||||
<section id="performance-collections-taxonomy">
|
||||
<section xml:id="performance-collections-taxonomy">
|
||||
<title>Taxonomy</title>
|
||||
|
||||
<para>Hibernate defines three basic kinds of collections:</para>
|
||||
|
@ -1484,7 +1459,7 @@ hibernate.cache.use_structured_entries true</programlisting>
|
|||
individual rows of the collection.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-collections-mostefficientupdate">
|
||||
<section xml:id="performance-collections-mostefficientupdate">
|
||||
<title>Lists, maps, idbags and sets are the most efficient collections
|
||||
to update</title>
|
||||
|
||||
|
@ -1513,7 +1488,7 @@ hibernate.cache.use_structured_entries true</programlisting>
|
|||
of collection update performance simply do not apply.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-collections-mostefficentinverse">
|
||||
<section xml:id="performance-collections-mostefficentinverse">
|
||||
<title>Bags and lists are the most efficient inverse collections</title>
|
||||
|
||||
<para>There is a particular case, however, in which bags, and also
|
||||
|
@ -1534,7 +1509,7 @@ p.getChildren().add(c); //no need to fetch the collection!
|
|||
sess.flush();</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="performance-collections-oneshotdelete">
|
||||
<section xml:id="performance-collections-oneshotdelete">
|
||||
<title>One shot delete</title>
|
||||
|
||||
<para>Deleting collection elements one by one can sometimes be extremely
|
||||
|
@ -1580,7 +1555,7 @@ sess.flush();</programlisting>
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="performance-monitoring" revision="1">
|
||||
<section xml:id="performance-monitoring" revision="1">
|
||||
<title>Monitoring performance</title>
|
||||
|
||||
<para>Optimization is not much use without monitoring and access to
|
||||
|
@ -1588,7 +1563,7 @@ sess.flush();</programlisting>
|
|||
internal operations. Statistics in Hibernate are available per
|
||||
<literal>SessionFactory</literal>.</para>
|
||||
|
||||
<section id="performance-monitoring-sf" revision="2">
|
||||
<section xml:id="performance-monitoring-sf" revision="2">
|
||||
<title>Monitoring a SessionFactory</title>
|
||||
|
||||
<para>You can access <literal>SessionFactory</literal> metrics in two
|
||||
|
@ -1644,7 +1619,7 @@ server.registerMBean(stats, on); // Register the MBean on the server</programlis
|
|||
(info level) using the <literal>logSummary()</literal> method.</para>
|
||||
</section>
|
||||
|
||||
<section id="performance-monitoring-metrics" revision="1">
|
||||
<section xml:id="performance-monitoring-metrics" revision="1">
|
||||
<title>Metrics</title>
|
||||
|
||||
<para>Hibernate provides a number of metrics, from basic information to
|
||||
|
|
|
@ -1,34 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter id="persistent-classes">
|
||||
<chapter xml:id="persistent-classes">
|
||||
<title>Persistent Classes</title>
|
||||
|
||||
<para>
|
||||
|
@ -45,10 +18,10 @@
|
|||
<interfacename>java.util.Map</interfacename> instances, for example).
|
||||
</para>
|
||||
|
||||
<section id="persistent-classes-pojo">
|
||||
<section xml:id="persistent-classes-pojo">
|
||||
<title>A simple POJO example</title>
|
||||
|
||||
<example id="persistent-classes-pojo-example-cat">
|
||||
<example xml:id="persistent-classes-pojo-example-cat">
|
||||
<title>Simple POJO representing a cat</title>
|
||||
<programlisting role="JAVA">package eg;
|
||||
import java.util.Set;
|
||||
|
@ -67,7 +40,7 @@ private float weight;
|
|||
private Set kittens = new HashSet();
|
||||
|
||||
private void setId(Long id) {
|
||||
this.id=id;
|
||||
this.xml:id=id;
|
||||
}
|
||||
public Long getId() {
|
||||
return id;
|
||||
|
@ -135,19 +108,19 @@ private float weight;
|
|||
The four main rules of persistent classes are explored in more detail in the following sections.
|
||||
</para>
|
||||
|
||||
<section id="persistent-classes-pojo-constructor">
|
||||
<section xml:id="persistent-classes-pojo-constructor">
|
||||
<title>Implement a no-argument constructor</title>
|
||||
|
||||
<para>
|
||||
<classname>Cat</classname> has a no-argument constructor. All persistent classes must have a default
|
||||
constructor (which can be non-public) so that Hibernate can instantiate them using
|
||||
<literal><classname>java.lang.reflect.Constructor</classname>.newInstance()</literal>. It is recommended
|
||||
<literal>java.lang.reflect.Constructor.newInstance()</literal>. It is recommended
|
||||
that this constructor be defined with at least <emphasis>package</emphasis> visibility in order for
|
||||
runtime proxy generation to work properly.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="persistent-classes-pojo-identifier" revision="2">
|
||||
<section xml:id="persistent-classes-pojo-identifier" revision="2">
|
||||
<title>Provide an identifier property</title>
|
||||
|
||||
<note>
|
||||
|
@ -180,7 +153,7 @@ private float weight;
|
|||
</section>
|
||||
|
||||
|
||||
<section id="persistent-classes-pojo-final">
|
||||
<section xml:id="persistent-classes-pojo-final">
|
||||
<title>Prefer non-final classes (semi-optional)</title>
|
||||
|
||||
<para>
|
||||
|
@ -194,12 +167,12 @@ private float weight;
|
|||
<xref linkend="persistent-classes-pojo-final-example-disable-proxies-ann"/>.
|
||||
</para>
|
||||
|
||||
<example id="persistent-classes-pojo-final-example-disable-proxies-xml">
|
||||
<example xml:id="persistent-classes-pojo-final-example-disable-proxies-xml">
|
||||
<title>Disabling proxies in <literal>hbm.xml</literal></title>
|
||||
<programlisting role="XML"><![CDATA[<class name="Cat" lazy="false"...>...</class>]]></programlisting>
|
||||
</example>
|
||||
|
||||
<example id="persistent-classes-pojo-final-example-disable-proxies-ann">
|
||||
<example xml:id="persistent-classes-pojo-final-example-disable-proxies-ann">
|
||||
<title>Disabling proxies in annotations</title>
|
||||
<programlisting role="JAVA"><![CDATA[@Entity @Proxy(lazy=false) public class Cat { ... }]]></programlisting>
|
||||
</example>
|
||||
|
@ -212,12 +185,12 @@ private float weight;
|
|||
|
||||
</para>
|
||||
|
||||
<example id="persistent-classes-pojo-final-example-proxy-interface-xml">
|
||||
<example xml:id="persistent-classes-pojo-final-example-proxy-interface-xml">
|
||||
<title>Proxying an interface in <literal>hbm.xml</literal></title>
|
||||
<programlisting role="XML"><![CDATA[<class name="Cat" proxy="ICat"...>...</class>]]></programlisting>
|
||||
</example>
|
||||
|
||||
<example id="persistent-classes-pojo-final-example-proxy-interface-ann">
|
||||
<example xml:id="persistent-classes-pojo-final-example-proxy-interface-ann">
|
||||
<title>Proxying an interface in annotations</title>
|
||||
<programlisting role="JAVA"><![CDATA[@Entity @Proxy(proxyClass=ICat.class) public class Cat implements ICat { ... }]]></programlisting>
|
||||
</example>
|
||||
|
@ -231,7 +204,7 @@ private float weight;
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="persistent-classes-pojo-accessors">
|
||||
<section xml:id="persistent-classes-pojo-accessors">
|
||||
<title>Declare accessors and mutators for persistent fields (optional)</title>
|
||||
|
||||
<para>
|
||||
|
@ -251,7 +224,7 @@ private float weight;
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="persistent-classes-inheritance">
|
||||
<section xml:id="persistent-classes-inheritance">
|
||||
<title>Implementing inheritance</title>
|
||||
|
||||
<para>A subclass must also observe the first and second rules. It inherits
|
||||
|
@ -272,7 +245,7 @@ public class DomesticCat extends Cat {
|
|||
}</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="persistent-classes-equalshashcode" revision="1">
|
||||
<section xml:id="persistent-classes-equalshashcode" revision="1">
|
||||
<title>Implementing <literal>equals()</literal> and
|
||||
<literal>hashCode()</literal></title>
|
||||
|
||||
|
@ -350,7 +323,7 @@ public class DomesticCat extends Cat {
|
|||
key.</para>
|
||||
</section>
|
||||
|
||||
<section id="persistent-classes-dynamicmodels">
|
||||
<section xml:id="persistent-classes-dynamicmodels">
|
||||
<title>Dynamic models</title>
|
||||
|
||||
<note>
|
||||
|
@ -478,7 +451,7 @@ dynamicSession.close()
|
|||
</section>
|
||||
|
||||
|
||||
<section id="persistent-classes-tuplizers" revision="1">
|
||||
<section xml:id="persistent-classes-tuplizers" revision="1">
|
||||
<title>Tuplizers</title>
|
||||
|
||||
<para>
|
||||
|
@ -521,7 +494,7 @@ dynamicSession.close()
|
|||
<xref linkend="example-specify-custom-tuplizer-xml"/> shows how to do the same in <literal>hbm.xml</literal>
|
||||
</para>
|
||||
|
||||
<example id="example-specify-custom-tuplizer-ann">
|
||||
<example xml:id="example-specify-custom-tuplizer-ann">
|
||||
<title>Specify custom tuplizers in annotations</title>
|
||||
<programlisting role="JAVA">@Entity
|
||||
@Tuplizer(impl = DynamicEntityTuplizer.class)
|
||||
|
@ -539,7 +512,7 @@ public interface Cuisine {
|
|||
public void setCountry(Country country);
|
||||
}</programlisting>
|
||||
</example>
|
||||
<example id="example-specify-custom-tuplizer-xml">
|
||||
<example xml:id="example-specify-custom-tuplizer-xml">
|
||||
<title>Specify custom tuplizers in <literal>hbm.xml</literal></title>
|
||||
<programlisting role="XML"><hibernate-mapping>
|
||||
<class entity-name="Customer">
|
||||
|
@ -561,7 +534,7 @@ public interface Cuisine {
|
|||
</example>
|
||||
</section>
|
||||
|
||||
<section id="persistent-classes-entity-name-resolver">
|
||||
<section xml:id="persistent-classes-entity-name-resolver">
|
||||
<title>EntityNameResolvers</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,36 +1,10 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (c) 2009, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="portability">
|
||||
<chapter xml:id="portability">
|
||||
<title>Database Portability Considerations</title>
|
||||
|
||||
<section id="portability-basics">
|
||||
<section xml:id="portability-basics">
|
||||
<title>Portability Basics</title>
|
||||
|
||||
<para>
|
||||
|
@ -43,7 +17,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="portability-dialect">
|
||||
<section xml:id="portability-dialect">
|
||||
<title>Dialect</title>
|
||||
|
||||
<para>
|
||||
|
@ -56,7 +30,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="portability-dialectresolver">
|
||||
<section xml:id="portability-dialectresolver">
|
||||
<title>Dialect resolution</title>
|
||||
|
||||
<para>
|
||||
|
@ -102,7 +76,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="portability-idgen">
|
||||
<section xml:id="portability-idgen">
|
||||
<title>Identifier generation</title>
|
||||
|
||||
<para>
|
||||
|
@ -132,7 +106,8 @@
|
|||
|
||||
<para>
|
||||
Starting with version 3.2.3, Hibernate comes with a set of
|
||||
<ulink url="http://in.relation.to/2082.lace">enhanced</ulink> identifier generators targetting
|
||||
<link xlink:href="http://in.relation.to/2082.lace" xmlns:xlink="http://www.w3.org/1999/xlink">enhanced</link>
|
||||
identifier generators targetting
|
||||
portability in a much different way.
|
||||
<note>
|
||||
<para>
|
||||
|
@ -158,7 +133,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="portability-functions">
|
||||
<section xml:id="portability-functions">
|
||||
<title>Database functions</title>
|
||||
|
||||
<warning>
|
||||
|
@ -191,7 +166,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="portability-types">
|
||||
<section xml:id="portability-types">
|
||||
<title>Type mappings</title>
|
||||
|
||||
<para>
|
||||
|
@ -200,11 +175,11 @@
|
|||
|
||||
<!--
|
||||
todo :
|
||||
<section id="portability-types-lobs">
|
||||
<section xml:id="portability-types-lobs">
|
||||
<title>BLOB/CLOB mappings</title>
|
||||
</section>
|
||||
|
||||
<section id="portability-types-bool">
|
||||
<section xml:id="portability-types-bool">
|
||||
<title>Boolean mappings</title>
|
||||
</section>
|
||||
-->
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE preface SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<preface id="preface">
|
||||
<preface xml:id="preface">
|
||||
<title>Preface</title>
|
||||
|
||||
<para>
|
||||
|
@ -37,7 +9,8 @@
|
|||
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 solution for Java environments.
|
||||
The term Object/Relational Mapping refers to the technique of mapping data from an object model representation
|
||||
to a relational data model representation (and visa versa). See <ulink url="http://en.wikipedia.org/wiki/Object-relational_mapping"/>
|
||||
to a relational data model representation (and visa versa). See
|
||||
<link xlink:href="http://en.wikipedia.org/wiki/Object-relational_mapping" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
for a good high-level discussion.
|
||||
</para>
|
||||
|
||||
|
@ -50,12 +23,12 @@
|
|||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://www.agiledata.org/essays/dataModeling101.html">http://www.agiledata.org/essays/dataModeling101.html</ulink>
|
||||
<link xlink:href="http://www.agiledata.org/essays/dataModeling101.html" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://en.wikipedia.org/wiki/Data_modeling">http://en.wikipedia.org/wiki/Data_modeling</ulink>
|
||||
<link xlink:href="http://en.wikipedia.org/wiki/Data_modeling" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
@ -117,8 +90,8 @@
|
|||
information. Consider reading <biblioref linkend="biblio-JPwH"/>
|
||||
if you need more help with application design, or if you prefer
|
||||
a step-by-step tutorial. Also visit
|
||||
<ulink url="http://caveatemptor.hibernate.org"/> and download
|
||||
the example application from <biblioref linkend="biblio-JPwH"/>.
|
||||
<link xlink:href="http://caveatemptor.hibernate.org" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
and download the example application from <biblioref linkend="biblio-JPwH"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -147,21 +120,21 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Trying stuff out and reporting bugs. See
|
||||
<ulink url="http://hibernate.org/issuetracker.html">http://hibernate.org/issuetracker.html</ulink>
|
||||
<link xlink:href="http://hibernate.org/issuetracker.html" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
details.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Trying your hand at fixing some bugs or implementing enhancements. Again, see
|
||||
<ulink url="http://hibernate.org/issuetracker.html">http://hibernate.org/issuetracker.html</ulink>
|
||||
<link xlink:href="http://hibernate.org/issuetracker.html" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
details.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://hibernate.org/community.html">http://hibernate.org/community.html</ulink> list
|
||||
a few ways to engage in the community.
|
||||
<link xlink:href="http://hibernate.org/community.html" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
lists a few ways to engage in the community.
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
|
@ -170,7 +143,8 @@
|
|||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
There are also <ulink url="http://en.wikipedia.org/wiki/Internet_Relay_Chat">IRC</ulink>
|
||||
There are also
|
||||
<link xlink:href="http://en.wikipedia.org/wiki/Internet_Relay_Chat" xmlns:xlink="http://www.w3.org/1999/xlink">IRC</link>
|
||||
channels for both user and developer discussions.
|
||||
</para>
|
||||
</listitem>
|
||||
|
|
|
@ -1,42 +1,14 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE preface SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="querycriteria">
|
||||
<chapter xml:id="querycriteria">
|
||||
<title>Criteria Queries</title>
|
||||
|
||||
<para>
|
||||
Hibernate features an intuitive, extensible criteria query API.
|
||||
</para>
|
||||
|
||||
<section id="querycriteria-creating">
|
||||
<section xml:id="querycriteria-creating">
|
||||
<title>Creating a <literal>Criteria</literal> instance</title>
|
||||
|
||||
<para>
|
||||
|
@ -51,7 +23,7 @@ List cats = crit.list();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-narrowing">
|
||||
<section xml:id="querycriteria-narrowing">
|
||||
<title>Narrowing the result set</title>
|
||||
|
||||
<para>
|
||||
|
@ -123,7 +95,7 @@ List cats = sess.createCriteria(Cat.class)
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-ordering">
|
||||
<section xml:id="querycriteria-ordering">
|
||||
<title>Ordering the results</title>
|
||||
|
||||
<para>
|
||||
|
@ -146,7 +118,7 @@ List cats = sess.createCriteria(Cat.class)
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-associations" revision="2">
|
||||
<section xml:id="querycriteria-associations" revision="2">
|
||||
<title>Associations</title>
|
||||
|
||||
<para>
|
||||
|
@ -230,7 +202,7 @@ while ( iter.hasNext() ) {
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-dynamicfetching" revision="1">
|
||||
<section xml:id="querycriteria-dynamicfetching" revision="1">
|
||||
<title>Dynamic association fetching</title>
|
||||
|
||||
<para>
|
||||
|
@ -251,7 +223,7 @@ while ( iter.hasNext() ) {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-components" revision="2">
|
||||
<section xml:id="querycriteria-components" revision="2">
|
||||
<title>Components</title>
|
||||
|
||||
<para>
|
||||
|
@ -275,7 +247,7 @@ while ( iter.hasNext() ) {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-collections" revision="1">
|
||||
<section xml:id="querycriteria-collections" revision="1">
|
||||
<title>Collections</title>
|
||||
<para>
|
||||
When using criteria against collections, there are two distinct cases. One is if
|
||||
|
@ -303,7 +275,7 @@ while ( iter.hasNext() ) {
|
|||
</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-examples">
|
||||
<section xml:id="querycriteria-examples">
|
||||
<title>Example queries</title>
|
||||
|
||||
<para>
|
||||
|
@ -348,7 +320,7 @@ List results = session.createCriteria(Cat.class)
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-projection">
|
||||
<section xml:id="querycriteria-projection">
|
||||
<title>Projections, aggregation and grouping</title>
|
||||
<para>
|
||||
The class <literal>org.hibernate.criterion.Projections</literal> is a
|
||||
|
@ -442,7 +414,7 @@ List results = session.createCriteria(Cat.class)
|
|||
|
||||
</section>
|
||||
|
||||
<section id="querycriteria-detachedqueries">
|
||||
<section xml:id="querycriteria-detachedqueries">
|
||||
<title>Detached queries and subqueries</title>
|
||||
<para>
|
||||
The <literal>DetachedCriteria</literal> class allows you to create a query outside the scope
|
||||
|
@ -505,7 +477,7 @@ session.createCriteria( Woman.class )
|
|||
user objects - similar to setResultClass in JDO2. General use of ResultTransformer
|
||||
could also be explained. -->
|
||||
|
||||
<section id="query-criteria-naturalid">
|
||||
<section xml:id="query-criteria-naturalid">
|
||||
<title>Queries by natural identifier</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="queryhql" revision="1">
|
||||
<chapter xml:id="queryhql" revision="1">
|
||||
<title>HQL: The Hibernate Query Language</title>
|
||||
|
||||
<para>
|
||||
|
@ -38,7 +10,7 @@
|
|||
and understands notions like inheritance, polymorphism and association.
|
||||
</para>
|
||||
|
||||
<section id="queryhql-casesensitivity">
|
||||
<section xml:id="queryhql-casesensitivity">
|
||||
<title>Case Sensitivity</title>
|
||||
|
||||
<para>
|
||||
|
@ -59,7 +31,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-from">
|
||||
<section xml:id="queryhql-from">
|
||||
<title>The from clause</title>
|
||||
|
||||
<para>
|
||||
|
@ -107,7 +79,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-joins" revision="2">
|
||||
<section xml:id="queryhql-joins" revision="2">
|
||||
<title>Associations and joins</title>
|
||||
|
||||
<para>
|
||||
|
@ -219,7 +191,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-joins-forms">
|
||||
<section xml:id="queryhql-joins-forms">
|
||||
<title>Forms of join syntax</title>
|
||||
|
||||
<para>
|
||||
|
@ -241,7 +213,7 @@
|
|||
<programlisting><![CDATA[from Cat as cat where cat.mate.name like '%s%']]></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="queryhql-identifier-property">
|
||||
<section xml:id="queryhql-identifier-property">
|
||||
<title>Referring to identifier property</title>
|
||||
|
||||
<para>
|
||||
|
@ -280,7 +252,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-select">
|
||||
<section xml:id="queryhql-select">
|
||||
<title>The select clause</title>
|
||||
|
||||
<para>
|
||||
|
@ -357,7 +329,7 @@ from Cat cat]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-aggregation">
|
||||
<section xml:id="queryhql-aggregation">
|
||||
<title>Aggregate functions</title>
|
||||
|
||||
<para>
|
||||
|
@ -422,7 +394,7 @@ select count(distinct cat.name), count(cat) from Cat cat]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-polymorphism">
|
||||
<section xml:id="queryhql-polymorphism">
|
||||
<title>Polymorphic queries</title>
|
||||
|
||||
<para>
|
||||
|
@ -456,7 +428,7 @@ select count(distinct cat.name), count(cat) from Cat cat]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-where" revision="1">
|
||||
<section xml:id="queryhql-where" revision="1">
|
||||
<title>The where clause</title>
|
||||
|
||||
<para>
|
||||
|
@ -583,7 +555,7 @@ where log.item.class = 'Payment' and log.item.id = payment.id]]></programlisting
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-expressions">
|
||||
<section xml:id="queryhql-expressions">
|
||||
<title>Expressions</title>
|
||||
|
||||
<para>
|
||||
|
@ -876,7 +848,7 @@ WHERE prod.name = 'widget'
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-ordering">
|
||||
<section xml:id="queryhql-ordering">
|
||||
<title>The order by clause</title>
|
||||
|
||||
<para>
|
||||
|
@ -892,7 +864,7 @@ order by cat.name asc, cat.weight desc, cat.birthdate]]></programlisting>
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="queryhql-grouping" revision="1">
|
||||
<section xml:id="queryhql-grouping" revision="1">
|
||||
<title>The group by clause</title>
|
||||
|
||||
<para>
|
||||
|
@ -940,7 +912,7 @@ order by count(kitten) asc, sum(kitten.weight) desc]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-subqueries" revision="3">
|
||||
<section xml:id="queryhql-subqueries" revision="3">
|
||||
<title>Subqueries</title>
|
||||
|
||||
<para>
|
||||
|
@ -983,7 +955,7 @@ from Cat as cat]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-examples">
|
||||
<section xml:id="queryhql-examples">
|
||||
<title>HQL examples</title>
|
||||
|
||||
<para>
|
||||
|
@ -1106,7 +1078,7 @@ order by account.type.sortOrder, account.accountNumber, payment.dueDate]]></prog
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-bulk" revision="2">
|
||||
<section xml:id="queryhql-bulk" revision="2">
|
||||
<title>Bulk update and delete</title>
|
||||
|
||||
<para>
|
||||
|
@ -1116,7 +1088,7 @@ order by account.type.sortOrder, account.accountNumber, payment.dueDate]]></prog
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="queryhql-tipstricks">
|
||||
<section xml:id="queryhql-tipstricks">
|
||||
<title>Tips & Tricks</title>
|
||||
|
||||
<para>
|
||||
|
@ -1196,7 +1168,7 @@ Collection counts = s.filter( collection, "select this.type, count(this) group b
|
|||
|
||||
</section>
|
||||
|
||||
<section id="queryhql-components">
|
||||
<section xml:id="queryhql-components">
|
||||
<title>Components</title>
|
||||
|
||||
<para>
|
||||
|
@ -1227,7 +1199,7 @@ Collection counts = s.filter( collection, "select this.type, count(this) group b
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="queryhql-tuple">
|
||||
<section xml:id="queryhql-tuple">
|
||||
<title>Row value constructor syntax</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,33 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="querysql" revision="2">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter xml:id="querysql" revision="2">
|
||||
<title>Native SQL</title>
|
||||
|
||||
<para>You can also express queries in the native SQL dialect of your
|
||||
|
@ -39,7 +13,7 @@
|
|||
<para>Hibernate3 allows you to specify handwritten SQL, including stored
|
||||
procedures, for all create, update, delete, and load operations.</para>
|
||||
|
||||
<section id="querysql-creating" revision="4">
|
||||
<section xml:id="querysql-creating" revision="4">
|
||||
<title>Using a <literal>SQLQuery</literal></title>
|
||||
|
||||
<para>Execution of native SQL queries is controlled via the
|
||||
|
@ -250,7 +224,7 @@ List loggedCats = sess.createSQLQuery(sql)
|
|||
.addEntity("mother", Cat.class).list()
|
||||
</programlisting>
|
||||
|
||||
<section id="querysql-aliasreferences" revision="2">
|
||||
<section xml:id="querysql-aliasreferences" revision="2">
|
||||
<title>Alias and property references</title>
|
||||
|
||||
<para>In most cases the above alias injection is needed. For queries
|
||||
|
@ -263,7 +237,7 @@ List loggedCats = sess.createSQLQuery(sql)
|
|||
simply examples; each alias will have a unique and probably different
|
||||
name when used.</para>
|
||||
|
||||
<table frame="topbot" id="aliasinjection-summary">
|
||||
<table frame="topbot" xml:id="aliasinjection-summary">
|
||||
<title>Alias injection names</title>
|
||||
|
||||
<tgroup cols="3">
|
||||
|
@ -418,7 +392,7 @@ List pusList = query.setString("name", "Pus%").list(); </programlisting
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="querysql-namedqueries" revision="3">
|
||||
<section xml:id="querysql-namedqueries" revision="3">
|
||||
<title>Named SQL queries</title>
|
||||
|
||||
<para>Named SQL queries can also be defined in the mapping document and
|
||||
|
@ -574,7 +548,7 @@ List pusList = query.setString("name", "Pus%").list(); </programlisting
|
|||
This can be seen in <xref
|
||||
linkend="example-field-result-annotation-with-associations" />.</para>
|
||||
|
||||
<example id="example-named-native-query-annotation-with-result-set-mapping">
|
||||
<example xml:id="example-named-native-query-annotation-with-result-set-mapping">
|
||||
<title>Named SQL query using <classname>@NamedNativeQuery</classname>
|
||||
together with <classname>@SqlResultSetMapping</classname></title>
|
||||
|
||||
|
@ -598,7 +572,7 @@ List pusList = query.setString("name", "Pus%").list(); </programlisting
|
|||
)</programlisting>
|
||||
</example>
|
||||
|
||||
<example id="example-implicit-result-set-mapping">
|
||||
<example xml:id="example-implicit-result-set-mapping">
|
||||
<title>Implicit result set mapping</title>
|
||||
|
||||
<programlisting language="JAVA" role="JAVA">@Entity
|
||||
|
@ -640,7 +614,7 @@ public class SpaceShip {
|
|||
}</programlisting>
|
||||
</example>
|
||||
|
||||
<example id="example-field-result-annotation-with-associations">
|
||||
<example xml:id="example-field-result-annotation-with-associations">
|
||||
<title>Using dot notation in @FieldResult for specifying associations
|
||||
</title>
|
||||
|
||||
|
@ -771,7 +745,7 @@ public class SpaceShip {</programlisting>
|
|||
<literal>org.hibernate.callable</literal> which can be true or false
|
||||
depending on whether the query is a stored procedure or not.</para>
|
||||
|
||||
<section id="propertyresults">
|
||||
<section xml:id="propertyresults">
|
||||
<title>Using return-property to explicitly specify column/alias
|
||||
names</title>
|
||||
|
||||
|
@ -824,7 +798,7 @@ public class SpaceShip {</programlisting>
|
|||
discriminator column.</para>
|
||||
</section>
|
||||
|
||||
<section id="sp_query" revision="1">
|
||||
<section xml:id="sp_query" revision="1">
|
||||
<title>Using stored procedures for querying</title>
|
||||
|
||||
<para>Hibernate3 provides support for queries via stored procedures and
|
||||
|
@ -869,7 +843,7 @@ BEGIN
|
|||
<literal><return-join></literal> and
|
||||
<literal><load-collection></literal> are not supported.</para>
|
||||
|
||||
<section id="querysql-limits-storedprocedures" revision="1">
|
||||
<section xml:id="querysql-limits-storedprocedures" revision="1">
|
||||
<title>Rules/limitations for using stored procedures</title>
|
||||
|
||||
<para>You cannot use stored procedures with Hibernate unless you
|
||||
|
@ -922,7 +896,7 @@ BEGIN
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="querysql-cud">
|
||||
<section xml:id="querysql-cud">
|
||||
<title>Custom SQL for create, update and delete</title>
|
||||
|
||||
<para>Hibernate3 can use custom SQL for create, update, and delete
|
||||
|
@ -932,7 +906,7 @@ BEGIN
|
|||
linkend="example-custom-crdu-via-annotations" /> shows how to define
|
||||
custom SQL operatons using annotations.</para>
|
||||
|
||||
<example id="example-custom-crdu-via-annotations">
|
||||
<example xml:id="example-custom-crdu-via-annotations">
|
||||
<title>Custom CRUD via annotations</title>
|
||||
|
||||
<programlisting language="JAVA" role="JAVA">@Entity
|
||||
|
@ -942,7 +916,7 @@ BEGIN
|
|||
@SQLDelete( sql="DELETE CHAOS WHERE id = ?")
|
||||
@SQLDeleteAll( sql="DELETE CHAOS")
|
||||
@Loader(namedQuery = "chaos")
|
||||
@NamedNativeQuery(name="chaos", query="select id, size, name, lower( nickname ) as nickname from CHAOS where id= ?", resultClass = Chaos.class)
|
||||
@NamedNativeQuery(name="chaos", query="select id, size, name, lower( nickname ) as nickname from CHAOS where xml:id= ?", resultClass = Chaos.class)
|
||||
public class Chaos {
|
||||
@Id
|
||||
private Long id;
|
||||
|
@ -960,7 +934,7 @@ public class Chaos {
|
|||
<literal><sql-delete></literal> nodes. This can be seen in <xref
|
||||
linkend="example-custom-crdu-via-xml" />.</para>
|
||||
|
||||
<example id="example-custom-crdu-via-xml">
|
||||
<example xml:id="example-custom-crdu-via-xml">
|
||||
<title>Custom CRUD XML</title>
|
||||
|
||||
<programlisting role="XML"><class name="Person">
|
||||
|
@ -969,8 +943,8 @@ public class Chaos {
|
|||
</id>
|
||||
<property name="name" not-null="true"/>
|
||||
<sql-insert>INSERT INTO PERSON (NAME, ID) VALUES ( UPPER(?), ? )</sql-insert>
|
||||
<sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE ID=?</sql-update>
|
||||
<sql-delete>DELETE FROM PERSON WHERE ID=?</sql-delete>
|
||||
<sql-update>UPDATE PERSON SET NAME=UPPER(?) WHERE xml:id=?</sql-update>
|
||||
<sql-delete>DELETE FROM PERSON WHERE xml:id=?</sql-delete>
|
||||
</class></programlisting>
|
||||
</example>
|
||||
|
||||
|
@ -1005,7 +979,7 @@ public class Chaos {
|
|||
to override the collection related statements -see <xref
|
||||
linkend="example-overriding-sql-collections-annotations" />.</para>
|
||||
|
||||
<example id="example-overriding-sql-collections-annotations">
|
||||
<example xml:id="example-overriding-sql-collections-annotations">
|
||||
<title>Overriding SQL statements for collections using
|
||||
annotations</title>
|
||||
|
||||
|
@ -1081,7 +1055,7 @@ END updatePerson;</programlisting>
|
|||
</example>
|
||||
</section>
|
||||
|
||||
<section id="querysql-load">
|
||||
<section xml:id="querysql-load">
|
||||
<title>Custom SQL for loading</title>
|
||||
|
||||
<para>You can also declare your own SQL (or HQL) queries for entity
|
||||
|
@ -1094,7 +1068,7 @@ END updatePerson;</programlisting>
|
|||
<return alias="pers" class="Person" lock-mode="upgrade"/>
|
||||
SELECT NAME AS {pers.name}, ID AS {pers.id}
|
||||
FROM PERSON
|
||||
WHERE ID=?
|
||||
WHERE xml:id=?
|
||||
FOR UPDATE
|
||||
</sql-query></programlisting>
|
||||
|
||||
|
@ -1137,7 +1111,7 @@ END updatePerson;</programlisting>
|
|||
FROM PERSON pers
|
||||
LEFT OUTER JOIN EMPLOYMENT emp
|
||||
ON pers.ID = emp.PERSON_ID
|
||||
WHERE ID=?
|
||||
WHERE xml:id=?
|
||||
</sql-query></programlisting>
|
||||
|
||||
<para>The annotation equivalent <literal><loader></literal> is the
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="readonly">
|
||||
<chapter xml:id="readonly">
|
||||
<title>Read-only entities</title>
|
||||
|
||||
<important>
|
||||
|
@ -124,7 +96,7 @@
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<section id="readonly-api">
|
||||
<section xml:id="readonly-api">
|
||||
<title>Making persistent entities read-only</title>
|
||||
|
||||
<para>
|
||||
|
@ -170,7 +142,7 @@
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<section id="readonly-api-immutable">
|
||||
<section xml:id="readonly-api-immutable">
|
||||
<title>Entities of immutable classes</title>
|
||||
|
||||
<para>
|
||||
|
@ -192,7 +164,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="readonly-api-loaddefault">
|
||||
<section xml:id="readonly-api-loaddefault">
|
||||
<title>Loading persistent entities as read-only</title>
|
||||
|
||||
<note>
|
||||
|
@ -279,7 +251,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="readonly-api-querycriteria">
|
||||
<section xml:id="readonly-api-querycriteria">
|
||||
<title>Loading read-only entities from an HQL query/criteria</title>
|
||||
|
||||
<note>
|
||||
|
@ -380,7 +352,7 @@ session.close();
|
|||
|
||||
</section>
|
||||
|
||||
<section id="readonly-api-entity">
|
||||
<section xml:id="readonly-api-entity">
|
||||
<title>Making a persistent entity read-only</title>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -434,7 +406,7 @@ s.flush();
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="readonly-proptypes">
|
||||
<section xml:id="readonly-proptypes">
|
||||
<title>Read-only affect on property type</title>
|
||||
|
||||
<para>
|
||||
|
@ -442,7 +414,7 @@ s.flush();
|
|||
affected by making an entity read-only.
|
||||
</para>
|
||||
|
||||
<table frame="topbot" id="readonly-proptype-summary">
|
||||
<table frame="topbot" xml:id="readonly-proptype-summary">
|
||||
<title>Affect of read-only entity on property types</title>
|
||||
<tgroup cols="2">
|
||||
<colspec colwidth="1*"/>
|
||||
|
@ -532,7 +504,7 @@ s.flush();
|
|||
is read-only, compared to when it is not read-only.
|
||||
</para>
|
||||
|
||||
<section id="readonly-proptypes-simple">
|
||||
<section xml:id="readonly-proptypes-simple">
|
||||
<title>Simple properties</title>
|
||||
|
||||
<para>
|
||||
|
@ -569,10 +541,10 @@ session.close();
|
|||
|
||||
</section>
|
||||
|
||||
<section id="readonly-prop-types-unidir">
|
||||
<section xml:id="readonly-prop-types-unidir">
|
||||
<title>Unidirectional associations</title>
|
||||
|
||||
<section id="readonly-proptypes-singleended-unidir">
|
||||
<section xml:id="readonly-proptypes-singleended-unidir">
|
||||
<title>Unidirectional one-to-one and many-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -678,7 +650,7 @@ session.close();</programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="readonly-proptypes-manyended-unidir">
|
||||
<section xml:id="readonly-proptypes-manyended-unidir">
|
||||
<title>Unidirectional one-to-many and many-to-many</title>
|
||||
|
||||
<para>
|
||||
|
@ -714,10 +686,10 @@ session.close();</programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="readonly-proptypes-bidir">
|
||||
<section xml:id="readonly-proptypes-bidir">
|
||||
<title>Bidirectional associations</title>
|
||||
|
||||
<section id="readonly-proptypes-onetoone-bidir">
|
||||
<section xml:id="readonly-proptypes-onetoone-bidir">
|
||||
<title>Bidirectional one-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -767,7 +739,7 @@ session.close();</programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="readonly-proptypes-onetomany-manytoone">
|
||||
<section xml:id="readonly-proptypes-onetomany-manytoone">
|
||||
<title>Bidirectional one-to-many/many-to-one</title>
|
||||
|
||||
<para>
|
||||
|
@ -818,7 +790,7 @@ session.close();</programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="readonly-proptypes-manytomany-bidir">
|
||||
<section xml:id="readonly-proptypes-manytomany-bidir">
|
||||
<title>Bidirectional many-to-many</title>
|
||||
<para>
|
||||
Hibernate treats bidirectional many-to-many
|
||||
|
|
|
@ -1,33 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
<chapter id="objectstate">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter xml:id="objectstate">
|
||||
<title>Working with objects</title>
|
||||
|
||||
<para>Hibernate is a full object/relational mapping solution that not only
|
||||
|
@ -43,7 +17,7 @@
|
|||
Hibernate and is only relevant for the application developer when tuning the
|
||||
performance of the system.</para>
|
||||
|
||||
<section id="objectstate-overview">
|
||||
<section xml:id="objectstate-overview">
|
||||
<title>Hibernate object states</title>
|
||||
|
||||
<para>Hibernate defines and supports the following object states:</para>
|
||||
|
@ -91,7 +65,7 @@
|
|||
Hibernate methods that trigger a transition) in more detail.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-makingpersistent" revision="1">
|
||||
<section xml:id="objectstate-makingpersistent" revision="1">
|
||||
<title>Making objects persistent</title>
|
||||
|
||||
<para>Newly instantiated instances of a persistent class are considered
|
||||
|
@ -163,7 +137,7 @@ sess.save( pk, new Long(1234) );</programlisting>
|
|||
chapter.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-loading">
|
||||
<section xml:id="objectstate-loading">
|
||||
<title>Loading an object</title>
|
||||
|
||||
<para>The <literal>load()</literal> methods of <literal>Session</literal>
|
||||
|
@ -231,7 +205,7 @@ sess.refresh(cat); //re-read the state (after the trigger executes)</programlist
|
|||
linkend="performance-fetching" />.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-querying" revision="1">
|
||||
<section xml:id="objectstate-querying" revision="1">
|
||||
<title>Querying</title>
|
||||
|
||||
<para>If you do not know the identifiers of the objects you are looking
|
||||
|
@ -242,7 +216,7 @@ sess.refresh(cat); //re-read the state (after the trigger executes)</programlist
|
|||
database, with optional support from Hibernate for result set conversion
|
||||
into objects.</para>
|
||||
|
||||
<section id="objectstate-querying-executing" revision="1">
|
||||
<section xml:id="objectstate-querying-executing" revision="1">
|
||||
<title>Executing queries</title>
|
||||
|
||||
<para>HQL and native SQL queries are represented with an instance of
|
||||
|
@ -284,7 +258,7 @@ Set uniqueMothers = new HashSet(mothersWithKittens.list());</programlisting>
|
|||
objects, but with their collections initialized. You can filter these
|
||||
duplicates through a <literal>Set</literal>.</para>
|
||||
|
||||
<section id="objectstate-querying-executing-iterate">
|
||||
<section xml:id="objectstate-querying-executing-iterate">
|
||||
<title>Iterating results</title>
|
||||
|
||||
<para>Occasionally, you might be able to achieve better performance by
|
||||
|
@ -312,7 +286,7 @@ while ( iter.hasNext() ) {
|
|||
}</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-querying-executing-tuples">
|
||||
<section xml:id="objectstate-querying-executing-tuples">
|
||||
<title>Queries that return tuples</title>
|
||||
|
||||
<para>Hibernate queries sometimes return tuples of objects. Each tuple
|
||||
|
@ -331,7 +305,7 @@ while ( kittensAndMothers.hasNext() ) {
|
|||
}</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-querying-executing-scalar" revision="1">
|
||||
<section xml:id="objectstate-querying-executing-scalar" revision="1">
|
||||
<title>Scalar results</title>
|
||||
|
||||
<para>Queries can specify a property of a class in the
|
||||
|
@ -354,7 +328,7 @@ while ( results.hasNext() ) {
|
|||
}</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-querying-executing-parameters">
|
||||
<section xml:id="objectstate-querying-executing-parameters">
|
||||
<title>Bind parameters</title>
|
||||
|
||||
<para>Methods on <literal>Query</literal> are provided for binding
|
||||
|
@ -398,7 +372,7 @@ q.setParameterList("namesList", names);
|
|||
List cats = q.list();</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-querying-executing-pagination">
|
||||
<section xml:id="objectstate-querying-executing-pagination">
|
||||
<title>Pagination</title>
|
||||
|
||||
<para>If you need to specify bounds upon your result set, that is, the
|
||||
|
@ -415,7 +389,7 @@ List cats = q.list();</programlisting>
|
|||
native SQL of your DBMS.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-querying-executing-scrolling">
|
||||
<section xml:id="objectstate-querying-executing-scrolling">
|
||||
<title>Scrollable iteration</title>
|
||||
|
||||
<para>If your JDBC driver supports scrollable
|
||||
|
@ -451,7 +425,7 @@ cats.close()</programlisting>
|
|||
if you need offline pagination functionality.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-querying-executing-named" revision="1">
|
||||
<section xml:id="objectstate-querying-executing-named" revision="1">
|
||||
<title>Externalizing named queries</title>
|
||||
|
||||
<para>Queries can also be configured as so called named queries using
|
||||
|
@ -463,7 +437,7 @@ cats.close()</programlisting>
|
|||
scope. A named query is defined by its name and the actual query
|
||||
string.</para>
|
||||
|
||||
<example id="example-named-query-annotation">
|
||||
<example xml:id="example-named-query-annotation">
|
||||
<title>Defining a named query using
|
||||
<classname>@NamedQuery</classname></title>
|
||||
|
||||
|
@ -503,7 +477,7 @@ public class MyDao {
|
|||
<para>Parameter binding and executing is done programatically as seen
|
||||
in <xref linkend="example-parameter-binding-named-query" />.</para>
|
||||
|
||||
<example id="example-parameter-binding-named-query">
|
||||
<example xml:id="example-parameter-binding-named-query">
|
||||
<title>Parameter binding of a named query</title>
|
||||
|
||||
<programlisting role="JAVA">Query q = sess.getNamedQuery("ByNameAndMaximumWeight");
|
||||
|
@ -526,7 +500,7 @@ List cats = q.list();</programlisting>
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-filtering" revision="1">
|
||||
<section xml:id="objectstate-filtering" revision="1">
|
||||
<title>Filtering collections</title>
|
||||
|
||||
<para>A collection <emphasis>filter</emphasis> is a special type of
|
||||
|
@ -564,7 +538,7 @@ List cats = q.list();</programlisting>
|
|||
.list();</programlisting>
|
||||
</section>
|
||||
|
||||
<section id="objecstate-querying-criteria" revision="1">
|
||||
<section xml:id="objecstate-querying-criteria" revision="1">
|
||||
<title>Criteria queries</title>
|
||||
|
||||
<para>HQL is extremely powerful, but some developers prefer to build
|
||||
|
@ -582,7 +556,7 @@ List cats = crit.list();</programlisting>
|
|||
linkend="querycriteria" />.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-querying-nativesql" revision="2">
|
||||
<section xml:id="objectstate-querying-nativesql" revision="2">
|
||||
<title>Queries in native SQL</title>
|
||||
|
||||
<para>You can express a query in SQL, using
|
||||
|
@ -609,7 +583,7 @@ List cats = crit.list();</programlisting>
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-modifying" revision="1">
|
||||
<section xml:id="objectstate-modifying" revision="1">
|
||||
<title>Modifying persistent objects</title>
|
||||
|
||||
<para><emphasis>Transactional persistent instances</emphasis> (i.e.
|
||||
|
@ -635,7 +609,7 @@ sess.flush(); // changes to cat are automatically detected and persisted</progr
|
|||
|
||||
</section>
|
||||
|
||||
<section id="objectstate-detached" revision="2">
|
||||
<section xml:id="objectstate-detached" revision="2">
|
||||
<title>Modifying detached objects</title>
|
||||
|
||||
<para>Many applications need to retrieve an object in one transaction,
|
||||
|
@ -699,7 +673,7 @@ sess.lock(pk, LockMode.UPGRADE);</programlisting>
|
|||
linkend="transactions-optimistic" />.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-saveorupdate">
|
||||
<section xml:id="objectstate-saveorupdate">
|
||||
<title>Automatic state detection</title>
|
||||
|
||||
<para>Hibernate users have requested a general purpose method that either
|
||||
|
@ -815,7 +789,7 @@ secondSession.saveOrUpdate(mate); // save the new instance (mate has a null id)
|
|||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-deleting" revision="1">
|
||||
<section xml:id="objectstate-deleting" revision="1">
|
||||
<title>Deleting persistent objects</title>
|
||||
|
||||
<para><literal>Session.delete()</literal> will remove an object's state
|
||||
|
@ -832,7 +806,7 @@ secondSession.saveOrUpdate(mate); // save the new instance (mate has a null id)
|
|||
children.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-replicating" revision="1">
|
||||
<section xml:id="objectstate-replicating" revision="1">
|
||||
<title>Replicating object between two different datastores</title>
|
||||
|
||||
<para>It is sometimes useful to be able to take a graph of persistent
|
||||
|
@ -887,7 +861,7 @@ session2.close();</programlisting>
|
|||
transactions and more.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-flushing">
|
||||
<section xml:id="objectstate-flushing">
|
||||
<title>Flushing the Session</title>
|
||||
|
||||
<para>Sometimes the <literal>Session</literal> will execute the SQL
|
||||
|
@ -982,7 +956,7 @@ sess.close();</programlisting>
|
|||
<xref linkend="transactions" />.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-transitive" revision="1">
|
||||
<section xml:id="objectstate-transitive" revision="1">
|
||||
<title>Transitive persistence</title>
|
||||
|
||||
<para>It is quite cumbersome to save, delete, or reattach individual
|
||||
|
@ -1084,7 +1058,7 @@ sess.close();</programlisting>
|
|||
association, this associated entity can be marked for deletion if
|
||||
<literal>orphanRemoval</literal> is set to true.</para>
|
||||
|
||||
<example id="example-one-to-many-with-orphan-removal">
|
||||
<example xml:id="example-one-to-many-with-orphan-removal">
|
||||
<title><literal>@OneToMany</literal> with
|
||||
<literal>orphanRemoval</literal></title>
|
||||
|
||||
|
@ -1123,8 +1097,9 @@ customer.getOrders().remove(order); //order will be deleted by cascade</programl
|
|||
<para>If the child object's lifespan is bounded by the lifespan of the
|
||||
parent object, make it a <emphasis>life cycle object</emphasis> by
|
||||
specifying
|
||||
<literal>cascade="all,delete-orphan"(<literal>@OneToMany(cascade=CascadeType.ALL,
|
||||
orphanRemoval=true)</literal>)</literal>.</para>
|
||||
<literal>cascade="all,delete-orphan"</literal> (<literal>@OneToMany(cascade=CascadeType.ALL,
|
||||
orphanRemoval=true)</literal>).
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
|
@ -1197,7 +1172,7 @@ customer.getOrders().remove(order); //order will be deleted by cascade</programl
|
|||
<literal>Session</literal>.</para>
|
||||
</section>
|
||||
|
||||
<section id="objectstate-metadata">
|
||||
<section xml:id="objectstate-metadata">
|
||||
<title>Using metadata</title>
|
||||
|
||||
<para>Hibernate requires a rich meta-level model of all entity and value
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="toolsetguide" revision="2">
|
||||
<chapter xml:id="toolsetguide" revision="2">
|
||||
<title>Toolset Guide</title>
|
||||
|
||||
<para>
|
||||
|
@ -79,7 +51,7 @@
|
|||
be used from "inside" Hibernate.
|
||||
</para>
|
||||
|
||||
<section id="toolsetguide-s1" revision="2">
|
||||
<section xml:id="toolsetguide-s1" revision="2">
|
||||
<title>Automatic schema generation</title>
|
||||
|
||||
<para>
|
||||
|
@ -99,7 +71,7 @@
|
|||
First, you must customize your mapping files to improve the generated schema. The next section covers schema customization.
|
||||
</para>
|
||||
|
||||
<section id="toolsetguide-s1-2" revision="3">
|
||||
<section xml:id="toolsetguide-s1-2" revision="3">
|
||||
<title>Customizing the schema</title>
|
||||
|
||||
<para>
|
||||
|
@ -199,7 +171,7 @@
|
|||
|
||||
<para>The following table summarizes these optional attributes.</para>
|
||||
|
||||
<table frame="topbot" id="schemattributes-summary" revision="2">
|
||||
<table frame="topbot" xml:id="schemattributes-summary" revision="2">
|
||||
<title>Summary</title>
|
||||
<tgroup cols="3">
|
||||
<colspec colwidth="1*"/>
|
||||
|
@ -310,7 +282,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="toolsetguide-s1-3" revision="2">
|
||||
<section xml:id="toolsetguide-s1-3" revision="2">
|
||||
<title>Running the tool</title>
|
||||
|
||||
<para>
|
||||
|
@ -390,7 +362,7 @@ new SchemaExport(cfg).create(false, true);]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="toolsetguide-s1-4">
|
||||
<section xml:id="toolsetguide-s1-4">
|
||||
<title>Properties</title>
|
||||
|
||||
<para>
|
||||
|
@ -451,7 +423,7 @@ new SchemaExport(cfg).create(false, true);]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="toolsetguide-s1-5">
|
||||
<section xml:id="toolsetguide-s1-5">
|
||||
<title>Using Ant</title>
|
||||
|
||||
<para>
|
||||
|
@ -478,7 +450,7 @@ new SchemaExport(cfg).create(false, true);]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="toolsetguide-s1-6" revision="2">
|
||||
<section xml:id="toolsetguide-s1-6" revision="2">
|
||||
<title>Incremental schema updates</title>
|
||||
|
||||
<para>
|
||||
|
@ -537,7 +509,7 @@ new SchemaUpdate(cfg).execute(false);]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="toolsetguide-s1-7">
|
||||
<section xml:id="toolsetguide-s1-7">
|
||||
<title>Using Ant for incremental schema updates</title>
|
||||
|
||||
<para>
|
||||
|
@ -560,7 +532,7 @@ new SchemaUpdate(cfg).execute(false);]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="toolsetguide-s1-8" revision="1">
|
||||
<section xml:id="toolsetguide-s1-8" revision="1">
|
||||
<title>Schema validation</title>
|
||||
|
||||
<para>
|
||||
|
@ -612,7 +584,7 @@ new SchemaValidator(cfg).validate();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="toolsetguide-s1-9">
|
||||
<section xml:id="toolsetguide-s1-9">
|
||||
<title>Using Ant for schema validation</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="transactions" revision="2">
|
||||
<chapter xml:id="transactions" revision="2">
|
||||
<title>Transactions and Concurrency</title>
|
||||
|
||||
<para>
|
||||
|
@ -60,7 +32,7 @@
|
|||
<literal>Session</literal>, as well as database transactions and long conversations.
|
||||
</para>
|
||||
|
||||
<section id="transactions-basics" revision="1">
|
||||
<section xml:id="transactions-basics" revision="1">
|
||||
<title>Session and transaction scopes</title>
|
||||
|
||||
<para>
|
||||
|
@ -92,7 +64,7 @@
|
|||
database transaction boundaries? These questions are addressed in the following sections.
|
||||
</para>
|
||||
|
||||
<section id="transactions-basics-uow" revision="1">
|
||||
<section xml:id="transactions-basics-uow" revision="1">
|
||||
<title>Unit of work</title>
|
||||
|
||||
<para>
|
||||
|
@ -173,7 +145,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-basics-apptx" revision="1">
|
||||
<section xml:id="transactions-basics-apptx" revision="1">
|
||||
<title>Long conversations</title>
|
||||
|
||||
<para>
|
||||
|
@ -267,7 +239,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-basics-identity">
|
||||
<section xml:id="transactions-basics-identity">
|
||||
<title>Considering object identity</title>
|
||||
|
||||
<para>
|
||||
|
@ -334,7 +306,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-basics-issues">
|
||||
<section xml:id="transactions-basics-issues">
|
||||
<title>Common issues</title>
|
||||
|
||||
<para>
|
||||
|
@ -386,7 +358,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-demarcation">
|
||||
<section xml:id="transactions-demarcation">
|
||||
<title>Database transaction demarcation</title>
|
||||
|
||||
<para>
|
||||
|
@ -451,7 +423,7 @@
|
|||
</para>
|
||||
|
||||
|
||||
<section id="transactions-demarcation-nonmanaged" revision="2">
|
||||
<section xml:id="transactions-demarcation-nonmanaged" revision="2">
|
||||
<title>Non-managed environment</title>
|
||||
|
||||
<para>
|
||||
|
@ -526,7 +498,7 @@ catch (RuntimeException e) {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-demarcation-jta" revision="3">
|
||||
<section xml:id="transactions-demarcation-jta" revision="3">
|
||||
<title>Using JTA</title>
|
||||
|
||||
<para>
|
||||
|
@ -629,7 +601,7 @@ catch (RuntimeException e) {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-demarcation-exceptions">
|
||||
<section xml:id="transactions-demarcation-exceptions">
|
||||
<title>Exception handling</title>
|
||||
|
||||
<para>
|
||||
|
@ -704,7 +676,7 @@ catch (RuntimeException e) {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-demarcation-timeout">
|
||||
<section xml:id="transactions-demarcation-timeout">
|
||||
<title>Transaction timeout</title>
|
||||
|
||||
<para>
|
||||
|
@ -749,7 +721,7 @@ finally {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-optimistic">
|
||||
<section xml:id="transactions-optimistic">
|
||||
<title>Optimistic concurrency control</title>
|
||||
|
||||
<para>
|
||||
|
@ -762,7 +734,7 @@ finally {
|
|||
also has the benefit of preventing lost updates in single database transactions.
|
||||
</para>
|
||||
|
||||
<section id="transactions-optimistic-manual">
|
||||
<section xml:id="transactions-optimistic-manual">
|
||||
<title>Application version checking</title>
|
||||
|
||||
<para>
|
||||
|
@ -811,7 +783,7 @@ session.close();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-optimistic-longsession">
|
||||
<section xml:id="transactions-optimistic-longsession">
|
||||
<title>Extended session and automatic versioning</title>
|
||||
|
||||
<para>
|
||||
|
@ -889,7 +861,7 @@ session.close(); // Only for last transaction in conversation]]></programlist
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-optimistic-detached">
|
||||
<section xml:id="transactions-optimistic-detached">
|
||||
<title>Detached objects and automatic versioning</title>
|
||||
|
||||
<para>
|
||||
|
@ -921,7 +893,7 @@ session.close();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-optimistic-customizing">
|
||||
<section xml:id="transactions-optimistic-customizing">
|
||||
<title>Customizing automatic versioning</title>
|
||||
|
||||
<para>
|
||||
|
@ -966,7 +938,7 @@ session.close();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-locking">
|
||||
<section xml:id="transactions-locking">
|
||||
<title>Pessimistic locking</title>
|
||||
|
||||
<para>
|
||||
|
@ -1068,7 +1040,7 @@ session.close();]]></programlisting>
|
|||
|
||||
</section>
|
||||
|
||||
<section id="transactions-connection-release">
|
||||
<section xml:id="transactions-connection-release">
|
||||
<title>Connection release modes</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,36 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
<!ENTITY mdash "-">
|
||||
]>
|
||||
|
||||
|
||||
<chapter id="tutorial">
|
||||
<chapter xml:id="tutorial">
|
||||
<title>Tutorial</title>
|
||||
|
||||
<para>
|
||||
|
@ -58,7 +29,7 @@
|
|||
</para>
|
||||
</note>
|
||||
|
||||
<section id="tutorial-firstapp">
|
||||
<section xml:id="tutorial-firstapp">
|
||||
<title>Part 1 - The first Hibernate Application</title>
|
||||
|
||||
<para>
|
||||
|
@ -69,20 +40,22 @@
|
|||
<note>
|
||||
<para>
|
||||
Although you can use whatever database you feel comfortable using, we
|
||||
will use <ulink url="http://hsqldb.org/">HSQLDB</ulink> (an in-memory,
|
||||
Java database) to avoid describing installation/setup of any particular
|
||||
will use <link xlink:href="http://hsqldb.org/" xmlns:xlink="http://www.w3.org/1999/xlink">HSQLDB</link>
|
||||
(an in-memory, Java database) to avoid describing installation/setup of any particular
|
||||
database servers.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<section id="tutorial-firstapp-setup">
|
||||
<section xml:id="tutorial-firstapp-setup">
|
||||
<title>Setup</title>
|
||||
|
||||
<para>
|
||||
The first thing we need to do is to set up the development environment. We
|
||||
will be using the "standard layout" advocated by alot of build tools such
|
||||
as <ulink url="http://maven.org">Maven</ulink>. Maven, in particular, has a
|
||||
good resource describing this <ulink url="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html">layout</ulink>.
|
||||
as <link xlink:href="http://maven.org" xmlns:xlink="http://www.w3.org/1999/xlink">Maven</link>.
|
||||
Maven, in particular, has a
|
||||
good resource describing this
|
||||
<link xlink:href="http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html" xmlns:xlink="http://www.w3.org/1999/xlink">layout</link>.
|
||||
As this tutorial is to be a web application, we will be creating and making
|
||||
use of <filename>src/main/java</filename>, <filename>src/main/resources</filename>
|
||||
and <filename>src/main/webapp</filename> directories.
|
||||
|
@ -142,7 +115,8 @@
|
|||
It is not a requirement to use Maven. If you wish to use something else to
|
||||
build this tutorial (such as Ant), the layout will remain the same. The only
|
||||
change is that you will need to manually account for all the needed
|
||||
dependencies. If you use something like <ulink url="http://ant.apache.org/ivy/">Ivy</ulink>
|
||||
dependencies. If you use something like
|
||||
<link xlink:href="http://ant.apache.org/ivy/" xmlns:xlink="http://www.w3.org/1999/xlink">Ivy</link>
|
||||
providing transitive dependency management you would still use the dependencies
|
||||
mentioned below. Otherwise, you'd need to grab <emphasis>all</emphasis>
|
||||
dependencies, both explicit and transitive, and add them to the project's
|
||||
|
@ -161,7 +135,7 @@
|
|||
</section>
|
||||
|
||||
|
||||
<section id="tutorial-firstapp-firstclass">
|
||||
<section xml:id="tutorial-firstapp-firstclass">
|
||||
<title>The first class</title>
|
||||
|
||||
<para>
|
||||
|
@ -243,7 +217,7 @@ public class Event {
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="tutorial-firstapp-mapping">
|
||||
<section xml:id="tutorial-firstapp-mapping">
|
||||
<title>The mapping file</title>
|
||||
|
||||
<para>
|
||||
|
@ -419,7 +393,7 @@ public class Event {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-firstapp-configuration" revision="2">
|
||||
<section xml:id="tutorial-firstapp-configuration" revision="2">
|
||||
<title>Hibernate configuration</title>
|
||||
|
||||
<para>
|
||||
|
@ -450,9 +424,10 @@ public class Event {
|
|||
how to obtain connections. For this tutorial we will be using a standalone connection
|
||||
pool (as opposed to a <interfacename>javax.sql.DataSource</interfacename>). Hibernate comes with
|
||||
support for two third-party open source JDBC connection pools:
|
||||
<ulink url="https://sourceforge.net/projects/c3p0">c3p0</ulink> and
|
||||
<ulink url="http://proxool.sourceforge.net/">proxool</ulink>. However, we will be using the
|
||||
Hibernate built-in connection pool for this tutorial.
|
||||
<link xlink:href="https://sourceforge.net/projects/c3p0" xmlns:xlink="http://www.w3.org/1999/xlink">c3p0</link>
|
||||
and
|
||||
<link xlink:href="http://proxool.sourceforge.net/" xmlns:xlink="http://www.w3.org/1999/xlink">proxool</link>.
|
||||
However, we will be using the Hibernate built-in connection pool for this tutorial.
|
||||
</para>
|
||||
|
||||
<caution>
|
||||
|
@ -547,13 +522,13 @@ public class Event {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-firstapp-mvn" revision="1">
|
||||
<section xml:id="tutorial-firstapp-mvn" revision="1">
|
||||
<title>Building with Maven</title>
|
||||
|
||||
<para>
|
||||
We will now build the tutorial with Maven. You will need to
|
||||
have Maven installed; it is available from the
|
||||
<ulink url="http://maven.apache.org/download.html">Maven download page</ulink>.
|
||||
<link xlink:href="http://maven.apache.org/download.html" xmlns:xlink="http://www.w3.org/1999/xlink">Maven download page</link>.
|
||||
Maven will read the <filename>/pom.xml</filename> file we created
|
||||
earlier and know how to perform some basic project tasks. First,
|
||||
lets run the <literal>compile</literal> goal to make sure we can compile
|
||||
|
@ -580,7 +555,7 @@ public class Event {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-firstapp-helpers" revision="3">
|
||||
<section xml:id="tutorial-firstapp-helpers" revision="3">
|
||||
<title>Startup and helpers</title>
|
||||
|
||||
<para>
|
||||
|
@ -670,7 +645,7 @@ public class HibernateUtil {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-firstapp-workingpersistence" revision="5">
|
||||
<section xml:id="tutorial-firstapp-workingpersistence" revision="5">
|
||||
<title>Loading and storing objects</title>
|
||||
|
||||
<para>
|
||||
|
@ -722,11 +697,11 @@ public class EventManager {
|
|||
</para>
|
||||
|
||||
<para>
|
||||
A <interface>org.hibernate.Session</interface> is designed to
|
||||
A <interfacename>org.hibernate.Session</interfacename> is designed to
|
||||
represent a single unit of work (a single atomic piece of work
|
||||
to be performed). For now we will keep things simple and assume
|
||||
a one-to-one granularity between a Hibernate
|
||||
<interface>org.hibernate.Session</interface> and a database
|
||||
<interfacename>org.hibernate.Session</interfacename> and a database
|
||||
transaction. To shield our code from the actual underlying
|
||||
transaction system we use the Hibernate
|
||||
<interfacename>org.hibernate.Transaction</interfacename> API.
|
||||
|
@ -758,28 +733,28 @@ public class EventManager {
|
|||
</important>
|
||||
|
||||
<para>
|
||||
A <interface>org.hibernate.Session</interface> begins when the
|
||||
A <interfacename>org.hibernate.Session</interfacename> begins when the
|
||||
first call to <literal>getCurrentSession()</literal> is made for
|
||||
the current thread. It is then bound by Hibernate to the current
|
||||
thread. When the transaction ends, either through commit or
|
||||
rollback, Hibernate automatically unbinds the
|
||||
<interface>org.hibernate.Session</interface> from the thread
|
||||
<interfacename>org.hibernate.Session</interfacename> from the thread
|
||||
and closes it for you. If you call
|
||||
<literal>getCurrentSession()</literal> again, you get a new
|
||||
<interface>org.hibernate.Session</interface> and can start a
|
||||
<interfacename>org.hibernate.Session</interfacename> and can start a
|
||||
new unit of work.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Related to the unit of work scope, should the Hibernate
|
||||
<interface>org.hibernate.Session</interface> be used to execute
|
||||
<interfacename>org.hibernate.Session</interfacename> be used to execute
|
||||
one or several database operations? The above example uses one
|
||||
<interface>org.hibernate.Session</interface> for one operation.
|
||||
<interfacename>org.hibernate.Session</interfacename> for one operation.
|
||||
However this is pure coincidence; the example is just not complex
|
||||
enough to show any other approach. The scope of a Hibernate
|
||||
<interface>org.hibernate.Session</interface> is flexible but you
|
||||
<interfacename>org.hibernate.Session</interfacename> is flexible but you
|
||||
should never design your application to use a new Hibernate
|
||||
<interface>org.hibernate.Session</interface> for
|
||||
<interfacename>org.hibernate.Session</interfacename> for
|
||||
<emphasis>every</emphasis> database operation. Even though it is
|
||||
used in the following examples, consider
|
||||
<emphasis>session-per-operation</emphasis> an anti-pattern.
|
||||
|
@ -862,7 +837,7 @@ public class EventManager {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-associations">
|
||||
<section xml:id="tutorial-associations">
|
||||
<title>Part 2 - Mapping associations</title>
|
||||
|
||||
<para>
|
||||
|
@ -872,7 +847,7 @@ public class EventManager {
|
|||
which they participate.
|
||||
</para>
|
||||
|
||||
<section id="tutorial-associations-mappinguser" revision="1">
|
||||
<section xml:id="tutorial-associations-mappinguser" revision="1">
|
||||
<title>Mapping the Person class</title>
|
||||
|
||||
<para>
|
||||
|
@ -933,7 +908,7 @@ public class Person {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-associations-unidirset" revision="3">
|
||||
<section xml:id="tutorial-associations-unidirset" revision="3">
|
||||
<title>A unidirectional Set-based association</title>
|
||||
|
||||
<para>
|
||||
|
@ -1024,7 +999,7 @@ public class Person {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-associations-working" revision="2">
|
||||
<section xml:id="tutorial-associations-working" revision="2">
|
||||
<title>Working the association</title>
|
||||
|
||||
<para>
|
||||
|
@ -1145,7 +1120,7 @@ public class Person {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-associations-valuecollections">
|
||||
<section xml:id="tutorial-associations-valuecollections">
|
||||
<title>Collection of values</title>
|
||||
|
||||
<para>
|
||||
|
@ -1237,7 +1212,7 @@ public class Person {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-associations-bidirectional" revision="1">
|
||||
<section xml:id="tutorial-associations-bidirectional" revision="1">
|
||||
<title>Bi-directional associations</title>
|
||||
|
||||
<para>
|
||||
|
@ -1296,7 +1271,7 @@ public class Person {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-associations-usingbidir">
|
||||
<section xml:id="tutorial-associations-usingbidir">
|
||||
<title>Working bi-directional links</title>
|
||||
|
||||
<para>
|
||||
|
@ -1354,7 +1329,7 @@ public class Person {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-webapp">
|
||||
<section xml:id="tutorial-webapp">
|
||||
<title>Part 3 - The EventManager web application</title>
|
||||
|
||||
<para>
|
||||
|
@ -1364,7 +1339,7 @@ public class Person {
|
|||
database, and it provides an HTML form to enter new events.
|
||||
</para>
|
||||
|
||||
<section id="tutorial-webapp-servlet" revision="2">
|
||||
<section xml:id="tutorial-webapp-servlet" revision="2">
|
||||
<title>Writing the basic servlet</title>
|
||||
|
||||
<para>
|
||||
|
@ -1446,7 +1421,7 @@ public class EventManagerServlet extends HttpServlet {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-webapp-processing" revision="1">
|
||||
<section xml:id="tutorial-webapp-processing" revision="1">
|
||||
<title>Processing and rendering</title>
|
||||
|
||||
<para>
|
||||
|
@ -1556,7 +1531,7 @@ public class EventManagerServlet extends HttpServlet {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-webapp-deploy">
|
||||
<section xml:id="tutorial-webapp-deploy">
|
||||
<title>Deploying and testing</title>
|
||||
|
||||
<para>
|
||||
|
@ -1591,7 +1566,8 @@ public class EventManagerServlet extends HttpServlet {
|
|||
<note>
|
||||
<para>
|
||||
If you do not have Tomcat installed, download it from
|
||||
<ulink url="http://tomcat.apache.org/"/> and follow the
|
||||
<link xlink:href="http://tomcat.apache.org/" xmlns:xlink="http://www.w3.org/1999/xlink"/>
|
||||
and follow the
|
||||
installation instructions. Our application requires
|
||||
no changes to the standard Tomcat configuration.
|
||||
</para>
|
||||
|
@ -1609,13 +1585,13 @@ public class EventManagerServlet extends HttpServlet {
|
|||
|
||||
</section>
|
||||
|
||||
<section id="tutorial-summary" revision="1">
|
||||
<section xml:id="tutorial-summary" revision="1">
|
||||
<title>Summary</title>
|
||||
|
||||
<para>
|
||||
This tutorial covered the basics of writing a simple standalone Hibernate application
|
||||
and a small web application. More tutorials are available from the Hibernate
|
||||
<ulink url="http://hibernate.org">website</ulink>.
|
||||
<link xlink:href="http://hibernate.org" xmlns:xlink="http://www.w3.org/1999/xlink">website</link>.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
|
|
@ -1,29 +1,6 @@
|
|||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<chapter id="types">
|
||||
<chapter xml:id="types">
|
||||
<title>Types</title>
|
||||
|
||||
<para>
|
||||
|
@ -52,7 +29,7 @@
|
|||
entity types (see <xref linkend="types-entity"/>).
|
||||
</para>
|
||||
|
||||
<section id="types-value">
|
||||
<section xml:id="types-value">
|
||||
<title>Value types</title>
|
||||
|
||||
<para>
|
||||
|
@ -63,7 +40,7 @@
|
|||
amd collection types (see <xref linkend="types-value-collection"/>).
|
||||
</para>
|
||||
|
||||
<section id="types-value-basic">
|
||||
<section xml:id="types-value-basic">
|
||||
<title>Basic value types</title>
|
||||
<para>
|
||||
The norm for basic value types is that they map a single database value (column) to a single,
|
||||
|
@ -72,7 +49,7 @@
|
|||
JDBC specification. We will later cover how to override these mapping and how to provide and use
|
||||
alternative type mappings.
|
||||
</para>
|
||||
<section id="types-value-basic-string">
|
||||
<section xml:id="types-value-basic-string">
|
||||
<title>java.lang.String</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -114,7 +91,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-character">
|
||||
<section xml:id="types-basic-value-character">
|
||||
<title><classname>java.lang.Character</classname> (or char primitive)</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -131,7 +108,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-value-basic-boolean">
|
||||
<section xml:id="types-value-basic-boolean">
|
||||
<title><classname>java.lang.Boolean</classname> (or boolean primitive)</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -184,7 +161,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-byte">
|
||||
<section xml:id="types-basic-value-byte">
|
||||
<title><classname>java.lang.Byte</classname> (or byte primitive)</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -201,7 +178,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-short">
|
||||
<section xml:id="types-basic-value-short">
|
||||
<title><classname>java.lang.Short</classname> (or short primitive)</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -218,7 +195,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-int">
|
||||
<section xml:id="types-basic-value-int">
|
||||
<title><classname>java.lang.Integer</classname> (or int primitive)</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -235,7 +212,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-long">
|
||||
<section xml:id="types-basic-value-long">
|
||||
<title><classname>java.lang.Long</classname> (or long primitive)</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -252,7 +229,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-float">
|
||||
<section xml:id="types-basic-value-float">
|
||||
<title><classname>java.lang.Float</classname> (or float primitive)</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -269,7 +246,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-double">
|
||||
<section xml:id="types-basic-value-double">
|
||||
<title><classname>java.lang.Double</classname> (or double primitive)</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -286,7 +263,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-biginteger">
|
||||
<section xml:id="types-basic-value-biginteger">
|
||||
<title><classname>java.math.BigInteger</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -303,7 +280,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-bigdecimal">
|
||||
<section xml:id="types-basic-value-bigdecimal">
|
||||
<title><classname>java.math.BigDecimal</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -320,7 +297,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-timestamp">
|
||||
<section xml:id="types-basic-value-timestamp">
|
||||
<title><classname>java.util.Date</classname> or <classname>java.sql.Timestamp</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -337,7 +314,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-time">
|
||||
<section xml:id="types-basic-value-time">
|
||||
<title><classname>java.sql.Time</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -354,7 +331,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-date">
|
||||
<section xml:id="types-basic-value-date">
|
||||
<title><classname>java.sql.Date</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -371,7 +348,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-calendar">
|
||||
<section xml:id="types-basic-value-calendar">
|
||||
<title><classname>java.util.Calendar</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -401,7 +378,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-currency">
|
||||
<section xml:id="types-basic-value-currency">
|
||||
<title><classname>java.util.Currency</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -418,7 +395,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-locale">
|
||||
<section xml:id="types-basic-value-locale">
|
||||
<title><classname>java.util.Locale</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -435,7 +412,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-timezone">
|
||||
<section xml:id="types-basic-value-timezone">
|
||||
<title><classname>java.util.TimeZone</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -452,7 +429,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-url">
|
||||
<section xml:id="types-basic-value-url">
|
||||
<title><classname>java.net.URL</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -469,7 +446,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-class">
|
||||
<section xml:id="types-basic-value-class">
|
||||
<title><classname>java.lang.Class</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -486,7 +463,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-blob">
|
||||
<section xml:id="types-basic-value-blob">
|
||||
<title><classname>java.sql.Blob</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -503,7 +480,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-clob">
|
||||
<section xml:id="types-basic-value-clob">
|
||||
<title><classname>java.sql.Clob</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -520,7 +497,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-binary" revision="1">
|
||||
<section xml:id="types-basic-value-binary" revision="1">
|
||||
<title>byte[]</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -561,7 +538,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-wrapperbinary" revision="1">
|
||||
<section xml:id="types-basic-value-wrapperbinary" revision="1">
|
||||
<title>Byte[]</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -578,7 +555,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-chararray">
|
||||
<section xml:id="types-basic-value-chararray">
|
||||
<title>char[]</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -595,7 +572,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-characterarray" revision="1">
|
||||
<section xml:id="types-basic-value-characterarray" revision="1">
|
||||
<title>Character[]</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -612,7 +589,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-uuid">
|
||||
<section xml:id="types-basic-value-uuid">
|
||||
<title><classname>java.util.UUID</classname></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -654,7 +631,7 @@
|
|||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<section id="types-basic-value-serializable">
|
||||
<section xml:id="types-basic-value-serializable">
|
||||
<title><interfacename>java.io.Serializable</interfacename></title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
|
@ -675,7 +652,7 @@
|
|||
</section>
|
||||
</section>
|
||||
|
||||
<section id="types-value-composite">
|
||||
<section xml:id="types-value-composite">
|
||||
<title>Composite types</title>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -695,7 +672,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="types-value-collection">
|
||||
<section xml:id="types-value-collection">
|
||||
<title>Collection types</title>
|
||||
<important>
|
||||
<para>
|
||||
|
@ -711,7 +688,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="types-entity">
|
||||
<section xml:id="types-entity">
|
||||
<title>Entity types</title>
|
||||
<para>
|
||||
The definition of entities is covered in detail in <xref linkend="persistent-classes"/>. For the purpose of
|
||||
|
@ -730,7 +707,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="types-category-significance">
|
||||
<section xml:id="types-category-significance">
|
||||
<title>Significance of type categories</title>
|
||||
<para>
|
||||
Why do we spend so much time categorizing the various types of types? What is the significance of the
|
||||
|
@ -753,7 +730,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="types-custom">
|
||||
<section xml:id="types-custom">
|
||||
<title>Custom types</title>
|
||||
<para>
|
||||
Hibernate makes it relatively easy for developers to create their own <emphasis>value</emphasis> types. For
|
||||
|
@ -769,7 +746,7 @@
|
|||
and <classname>java.util.Currency</classname> together into a custom <classname>Money</classname> class.
|
||||
</para>
|
||||
|
||||
<section id="types-custom-type">
|
||||
<section xml:id="types-custom-type">
|
||||
<title>Custom types using <interfacename>org.hibernate.type.Type</interfacename></title>
|
||||
<para>
|
||||
The first approach is to directly implement the <interfacename>org.hibernate.type.Type</interfacename>
|
||||
|
@ -781,7 +758,7 @@
|
|||
<classname>Money</classname>, which is the key we would use to register our type in the registry:
|
||||
</para>
|
||||
|
||||
<example id="types-custom-type-ex-definition">
|
||||
<example xml:id="types-custom-type-ex-definition">
|
||||
<title>Defining and registering the custom Type</title>
|
||||
<programlisting role="JAVA"><![CDATA[public class MoneyType implements BasicType {
|
||||
public String[] getRegistrationKeys() {
|
||||
|
@ -843,7 +820,7 @@ cfg...;
|
|||
</important>
|
||||
</section>
|
||||
|
||||
<section id="types-custom-ut">
|
||||
<section xml:id="types-custom-ut">
|
||||
<title>Custom types using <interfacename>org.hibernate.usertype.UserType</interfacename></title>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -859,7 +836,7 @@ cfg...;
|
|||
interface. Using a <interfacename>org.hibernate.usertype.UserType</interfacename>, our
|
||||
<classname>Money</classname> custom type would look as follows:
|
||||
</para>
|
||||
<example id="types-custom-ut-ex-definition">
|
||||
<example xml:id="types-custom-ut-ex-definition">
|
||||
<title>Defining the custom UserType</title>
|
||||
<programlisting role="JAVA"><![CDATA[public class MoneyType implements UserType {
|
||||
public int[] sqlTypes() {
|
||||
|
@ -906,7 +883,7 @@ cfg...;
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="types-custom-cut">
|
||||
<section xml:id="types-custom-cut">
|
||||
<title>Custom types using <interfacename>org.hibernate.usertype.CompositeUserType</interfacename></title>
|
||||
<para>
|
||||
The third and final approach is the use the <interfacename>org.hibernate.usertype.CompositeUserType</interfacename>
|
||||
|
@ -918,7 +895,7 @@ cfg...;
|
|||
<classname>Money</classname> custom type would look as follows:
|
||||
</para>
|
||||
|
||||
<example id="types-custom-cut-ex-definition">
|
||||
<example xml:id="types-custom-cut-ex-definition">
|
||||
<title>Defining the custom CompositeUserType</title>
|
||||
<programlisting role="JAVA"><![CDATA[public class MoneyType implements CompositeUserType {
|
||||
public String[] getPropertyNames() {
|
||||
|
@ -1002,7 +979,7 @@ cfg...;
|
|||
|
||||
</section>
|
||||
|
||||
<section id="types-registry">
|
||||
<section xml:id="types-registry">
|
||||
<title>Type registry</title>
|
||||
<para>
|
||||
Internally Hibernate uses a registry of basic types (see <xref linkend="types-value-basic"/>) when
|
||||
|
@ -1016,7 +993,7 @@ cfg...;
|
|||
class when bootstrapping Hibernate. For example, lets say you want Hibernate to use your custom
|
||||
<classname>SuperDuperStringType</classname>; during bootstrap you would call:
|
||||
</para>
|
||||
<example id="type-registry-override-ex">
|
||||
<example xml:id="type-registry-override-ex">
|
||||
<title>Overriding the standard <classname>StringType</classname></title>
|
||||
<programlisting role="JAVA"><![CDATA[Configuration cfg = ...;
|
||||
cfg.registerTypeOverride( new SuperDuperStringType() );]]></programlisting>
|
||||
|
|
|
@ -1,35 +1,7 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Middleware LLC.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
<!DOCTYPE chapter SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd">
|
||||
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<chapter id="xml">
|
||||
<chapter xml:id="xml">
|
||||
<title>XML Mapping</title>
|
||||
|
||||
<para><emphasis>
|
||||
|
@ -37,7 +9,7 @@
|
|||
active development.
|
||||
</emphasis></para>
|
||||
|
||||
<section id="xml-intro" revision="1">
|
||||
<section xml:id="xml-intro" revision="1">
|
||||
<title>Working with XML data</title>
|
||||
|
||||
<para>
|
||||
|
@ -68,7 +40,7 @@
|
|||
it can be used to map just the XML.
|
||||
</para>
|
||||
|
||||
<section id="xml-intro-mapping">
|
||||
<section xml:id="xml-intro-mapping">
|
||||
<title>Specifying XML and class mapping together</title>
|
||||
|
||||
<para>
|
||||
|
@ -97,7 +69,7 @@
|
|||
</class>]]></programlisting>
|
||||
</section>
|
||||
|
||||
<section id="xml-onlyxml">
|
||||
<section xml:id="xml-onlyxml">
|
||||
<title>Specifying only an XML mapping</title>
|
||||
|
||||
<para>
|
||||
|
@ -138,7 +110,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="xml-mapping" revision="1">
|
||||
<section xml:id="xml-mapping" revision="1">
|
||||
<title>XML mapping metadata</title>
|
||||
|
||||
<para>
|
||||
|
@ -227,7 +199,7 @@
|
|||
would return datasets such as this:
|
||||
</para>
|
||||
|
||||
<programlisting role="XML"><![CDATA[<customer id="123456789">
|
||||
<programlisting role="XML"><![CDATA[<customer xml:id="123456789">
|
||||
<account short-desc="Savings">987632567</account>
|
||||
<account short-desc="Credit Card">985612323</account>
|
||||
<name>
|
||||
|
@ -243,13 +215,13 @@
|
|||
mapping, the data might look more like this:
|
||||
</para>
|
||||
|
||||
<programlisting role="XML"><![CDATA[<customer id="123456789">
|
||||
<account id="987632567" short-desc="Savings">
|
||||
<customer id="123456789"/>
|
||||
<programlisting role="XML"><![CDATA[<customer xml:id="123456789">
|
||||
<account xml:id="987632567" short-desc="Savings">
|
||||
<customer xml:id="123456789"/>
|
||||
<balance>100.29</balance>
|
||||
</account>
|
||||
<account id="985612323" short-desc="Credit Card">
|
||||
<customer id="123456789"/>
|
||||
<account xml:id="985612323" short-desc="Credit Card">
|
||||
<customer xml:id="123456789"/>
|
||||
<balance>-2370.34</balance>
|
||||
</account>
|
||||
<name>
|
||||
|
@ -263,7 +235,7 @@
|
|||
</section>
|
||||
|
||||
|
||||
<section id="xml-manipulation" revision="1">
|
||||
<section xml:id="xml-manipulation" revision="1">
|
||||
<title>Manipulating XML data</title>
|
||||
|
||||
<para>
|
||||
|
|
|
@ -1,43 +1,52 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Getting_Started_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<authorgroup>
|
||||
|
||||
<authorgroup xmlns="http://docbook.org/ns/docbook">
|
||||
<author>
|
||||
<firstname>Gavin</firstname>
|
||||
<surname>King</surname>
|
||||
<personname>
|
||||
<firstname>Gavin</firstname>
|
||||
<surname>King</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Christian</firstname>
|
||||
<surname>Bauer</surname>
|
||||
<personname>
|
||||
<firstname>Christian</firstname>
|
||||
<surname>Bauer</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Emmanuel</firstname>
|
||||
<surname>Bernard</surname>
|
||||
<personname>
|
||||
<firstname>Steve</firstname>
|
||||
<surname>Ebersole</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Steve</firstname>
|
||||
<surname>Ebersole</surname>
|
||||
<personname>
|
||||
<firstname>Emmanuel</firstname>
|
||||
<surname>Bernard</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<personname>
|
||||
<firstname>Adam</firstname>
|
||||
<surname>Warski</surname>
|
||||
</personname>
|
||||
</author>
|
||||
<author>
|
||||
<firstname>Adam</firstname>
|
||||
<surname>Warski</surname>
|
||||
</author>
|
||||
|
||||
<othercredit>
|
||||
<firstname>James</firstname>
|
||||
<surname>Cobb</surname>
|
||||
<personname>
|
||||
<firstname>James</firstname>
|
||||
<surname>Cobb</surname>
|
||||
</personname>
|
||||
<affiliation>
|
||||
<shortaffil>Graphic Design</shortaffil>
|
||||
</affiliation>
|
||||
</othercredit>
|
||||
|
||||
<othercredit>
|
||||
<firstname>Cheyenne</firstname>
|
||||
<surname>Weaver</surname>
|
||||
<personname>
|
||||
<firstname>Cheyenne</firstname>
|
||||
<surname>Weaver</surname>
|
||||
</personname>
|
||||
<affiliation>
|
||||
<shortaffil>Graphic Design</shortaffil>
|
||||
</affiliation>
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE bookinfo PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Getting_Started_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<bookinfo id="Hibernate_Getting_Started_Guide">
|
||||
<title>Hibernate Getting Started Guide</title>
|
||||
<releaseinfo>&version;</releaseinfo>
|
||||
<edition>1.0</edition>
|
||||
<pubsnumber>1</pubsnumber>
|
||||
<productname>JBoss Hibernate Core</productname>
|
||||
<productnumber>&version;</productnumber>
|
||||
<pubdate>&today;</pubdate>
|
||||
<issuenum>1</issuenum>
|
||||
<mediaobject>
|
||||
<imageobject role="fo">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" align="center" />
|
||||
</imageobject>
|
||||
<imageobject role="html">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" depth="3cm" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
<copyright>
|
||||
<year>©rightYear;</year>
|
||||
<holder>©rightHolder;</holder>
|
||||
</copyright>
|
||||
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
</bookinfo>
|
|
@ -1,11 +1,33 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Getting_Started_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
<!DOCTYPE book SYSTEM "http://docbook.org/xml/5.0/dtd/docbook.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "Hibernate_Getting_Started_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<book>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="Book_Info.xml" />
|
||||
<info>
|
||||
<title>Hibernate Getting Started Guide</title>
|
||||
<releaseinfo>&version;</releaseinfo>
|
||||
<edition>1.0</edition>
|
||||
<productname>JBoss Hibernate Core</productname>
|
||||
<productnumber>&version;</productnumber>
|
||||
<pubdate>&today;</pubdate>
|
||||
<issuenum>1</issuenum>
|
||||
<mediaobject>
|
||||
<imageobject role="fo">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" align="center" />
|
||||
</imageobject>
|
||||
<imageobject role="html">
|
||||
<imagedata fileref="images/hibernate_logo_a.png" depth="3cm" />
|
||||
</imageobject>
|
||||
</mediaobject>
|
||||
<copyright>
|
||||
<year>©rightYear;</year>
|
||||
<holder>©rightHolder;</holder>
|
||||
</copyright>
|
||||
<xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
|
||||
</info>
|
||||
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/preface.xml" />
|
||||
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="content/obtaining.xml" />
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
|
||||
|
||||
<chapter id="hibernate-gsg-obtain">
|
||||
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Obtaining Hibernate</title>
|
||||
|
||||
<section id="hibernate-gsg-setup-releaseBundle">
|
||||
<section xml:id="hibernate-gsg-setup-releaseBundle">
|
||||
<title>Release Bundle Downloads</title>
|
||||
<para>
|
||||
The Hibernate team provides release bundles hosted on the SourceForge File Release System, in
|
||||
|
@ -17,7 +15,7 @@
|
|||
</para>
|
||||
<para>
|
||||
You can download releases of Hibernate, in your chosen format, from the list at
|
||||
<ulink url="http://sourceforge.net/projects/hibernate/files/hibernate4/"/>.
|
||||
<link xlink:href="http://sourceforge.net/projects/hibernate/files/hibernate4/"/>.
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
|
@ -31,7 +29,7 @@
|
|||
The <filename>/lib/jpa/</filename> directory contains the
|
||||
<systemitem>hibernate-entitymanager</systemitem> jar and its dependencies beyond those
|
||||
in <filename>lib/required/</filename>. This defines Hibernate support for
|
||||
<ulink url="http://jcp.org/en/jsr/detail?id=317">JPA</ulink>.
|
||||
<link xlink:href="http://jcp.org/en/jsr/detail?id=317">JPA</link>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -49,7 +47,7 @@
|
|||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-setup-mavenRepoArtifacts">
|
||||
<section xml:id="hibernate-gsg-setup-mavenRepoArtifacts">
|
||||
<title>Maven Repository Artifacts</title>
|
||||
<note>
|
||||
<para>
|
||||
|
@ -60,18 +58,18 @@
|
|||
<title>Maven Repository Wiki Pages</title>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://community.jboss.org/docs/DOC-14900"/> - General information about the repository.
|
||||
<link xlink:href="http://community.jboss.org/docs/DOC-14900"/> - General information about the repository.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://community.jboss.org/docs/DOC-15170"/> - Information about setting up the JBoss
|
||||
<link xlink:href="http://community.jboss.org/docs/DOC-15170"/> - Information about setting up the JBoss
|
||||
repositories in order to do development work on JBoss projects themselves.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://community.jboss.org/docs/DOC-15169"/> - Information about setting up access to
|
||||
<link xlink:href="http://community.jboss.org/docs/DOC-15169"/> - Information about setting up access to
|
||||
the repository to use JBoss projects as part of your own software.
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -99,7 +97,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Represents Hibernate's implementation of <phrase>JPA</phrase>, as specified at
|
||||
<ulink url="http://jcp.org/en/jsr/detail?id=317"/>.
|
||||
<link xlink:href="http://jcp.org/en/jsr/detail?id=317"/>.
|
||||
</para>
|
||||
<para>
|
||||
This artifact depends on <systemitem>hibernate-core</systemitem>
|
||||
|
@ -123,7 +121,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Provides integration between Hibernate and the <application>C3P0</application> connection
|
||||
pool library. See <ulink url="http://sourceforge.net/projects/c3p0/"/> for information
|
||||
pool library. See <link xlink:href="http://sourceforge.net/projects/c3p0/"/> for information
|
||||
about <application>C3P0</application>.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -138,7 +136,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Provides integration between Hibernate and the <application>Proxool</application> connection
|
||||
pool library. See <ulink url="http://proxool.sourceforge.net/"/> for more information about
|
||||
pool library. See <link xlink:href="http://proxool.sourceforge.net/"/> for more information about
|
||||
this library.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -153,7 +151,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Privides integration between Hibernate and <application>EhCache</application>, as a
|
||||
second-level cache. See <ulink url="http://ehcache.sourceforge.net/"/> for more
|
||||
second-level cache. See <link xlink:href="http://ehcache.sourceforge.net/"/> for more
|
||||
information about<application>EhCache</application>.
|
||||
</para>
|
||||
<para>
|
||||
|
@ -168,7 +166,7 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Provides integration between Hibernate and <application>Infinispan</application>, as a
|
||||
second-level cache. See <ulink url="http://jboss.org/infinispan"/> for more information
|
||||
second-level cache. See <link xlink:href="http://jboss.org/infinispan"/> for more information
|
||||
about <application>Infinispan</application>.
|
||||
</para>
|
||||
<para>
|
||||
|
|
|
@ -1,49 +1,15 @@
|
|||
<?xml version='1.0' encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Hibernate, Relational Persistence for Idiomatic Java
|
||||
~
|
||||
~ Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||
~ indicated by the @author tags or express copyright attribution
|
||||
~ statements applied by the authors. All third-party contributions are
|
||||
~ distributed under license by Red Hat Inc.
|
||||
~
|
||||
~ This copyrighted material is made available to anyone wishing to use, modify,
|
||||
~ copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
~ Lesser General Public License, as published by the Free Software Foundation.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
~ for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU Lesser General Public License
|
||||
~ along with this distribution; if not, write to:
|
||||
~ Free Software Foundation, Inc.
|
||||
~ 51 Franklin Street, Fifth Floor
|
||||
~ Boston, MA 02110-1301 USA
|
||||
-->
|
||||
|
||||
<!DOCTYPE preface PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "../Hibernate_Getting_Started_Guide.ent">
|
||||
%BOOK_ENTITIES;
|
||||
|
||||
]>
|
||||
|
||||
<preface id="hibernate-gsg-preface">
|
||||
<preface xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" >
|
||||
<title>Preface</title>
|
||||
|
||||
<!--
|
||||
NOTE : This duplicates a lot of the information in the manual preface. This is a great example of where the
|
||||
"content reuse" capabilities of DITA could be leveraged.
|
||||
-->
|
||||
|
||||
<para>
|
||||
Working with both Object-Oriented software and Relational Databases can be cumbersome and time 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 solution for Java environments. The
|
||||
term Object/Relational Mapping refers to the technique of mapping data between an object model representation to
|
||||
a relational data model representation. See <ulink
|
||||
url="http://en.wikipedia.org/wiki/Object-relational_mapping"/> for a good high-level discussion.
|
||||
a relational data model representation. See
|
||||
<link xlink:href="http://en.wikipedia.org/wiki/Object-relational_mapping"/> for a good high-level discussion.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
|
@ -56,12 +22,12 @@
|
|||
<title>Data Modeling Resources</title>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://www.agiledata.org/essays/dataModeling101.html"/>
|
||||
<link xlink:href="http://www.agiledata.org/essays/dataModeling101.html"/>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<ulink url="http://en.wikipedia.org/wiki/Data_modeling"/>
|
||||
<link xlink:href="http://en.wikipedia.org/wiki/Data_modeling"/>
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
@ -91,19 +57,19 @@
|
|||
<listitem>
|
||||
<para>
|
||||
Use Hibernate and report any bugs or issues you find. See
|
||||
<ulink url="http://hibernate.org/issuetracker.html"/> for details.
|
||||
<link xlink:href="http://hibernate.org/issuetracker.html"/> for details.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Try your hand at fixing some bugs or implementing enhancements. Again, see
|
||||
<ulink url="http://hibernate.org/issuetracker.html"/>.
|
||||
<link xlink:href="http://hibernate.org/issuetracker.html"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Engage with the community using mailing lists, forums, IRC, or other ways listed at
|
||||
<ulink url="http://hibernate.org/community.html"/>.
|
||||
<link xlink:href="http://hibernate.org/community.html"/>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
@ -125,7 +91,7 @@
|
|||
<title>Tutorial code</title>
|
||||
<para>
|
||||
The referenced projects and code for the tutorials in this guide are available at
|
||||
<ulink url="files/hibernate-tutorials.zip"/>.
|
||||
<link xlink:href="files/hibernate-tutorials.zip"/>.
|
||||
</para>
|
||||
</section>
|
||||
</preface>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
|
||||
<chapter id="hibernate-gsg-tutorial-annotations">
|
||||
<chapter xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Tutorial Using Native Hibernate APIs and Annotation Mappings</title>
|
||||
|
||||
<para>
|
||||
|
@ -22,7 +21,7 @@
|
|||
</itemizedlist>
|
||||
|
||||
|
||||
<section id="hibernate-gsg-tutorial-annotations-config">
|
||||
<section xml:id="hibernate-gsg-tutorial-annotations-config">
|
||||
<title>The Hibernate configuration file</title>
|
||||
|
||||
<para>
|
||||
|
@ -32,7 +31,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-annotations-entity">
|
||||
<section xml:id="hibernate-gsg-tutorial-annotations-entity">
|
||||
<title>The annotated entity Java class</title>
|
||||
<para>
|
||||
The entity class in this tutorial is <classname>org.hibernate.tutorial.annotations.Event</classname> which
|
||||
|
@ -41,7 +40,7 @@
|
|||
rather than a separate <filename>hbm.xml</filename> file.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-annotations-entity-entity">
|
||||
<example xml:id="hibernate-gsg-tutorial-annotations-entity-entity">
|
||||
<title>Identifying the class as an entity</title>
|
||||
<programlisting role="JAVA">@Entity
|
||||
@Table( name = "EVENTS" )
|
||||
|
@ -60,7 +59,7 @@ public class Event {
|
|||
literal value, not a table as a table -->
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-annotations-entity-id">
|
||||
<example xml:id="hibernate-gsg-tutorial-annotations-entity-id">
|
||||
<title>Identifying the identifier property</title>
|
||||
<programlisting role="JAVA">@Id
|
||||
@GeneratedValue(generator="increment")
|
||||
|
@ -78,7 +77,7 @@ public Long getId() {
|
|||
strategy for this entity's identifier values.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-annotations-entity-properties">
|
||||
<example xml:id="hibernate-gsg-tutorial-annotations-entity-properties">
|
||||
<title>Identifying basic properties</title>
|
||||
<programlisting role="JAVA">public String getTitle() {
|
||||
return title;
|
||||
|
@ -97,7 +96,7 @@ public Date getDate() {
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-annotations-test">
|
||||
<section xml:id="hibernate-gsg-tutorial-annotations-test">
|
||||
<title>Example code</title>
|
||||
<para>
|
||||
<classname>org.hibernate.tutorial.annotations.AnnotationsIllustrationTest</classname> is essentially the
|
||||
|
@ -106,7 +105,7 @@ public Date getDate() {
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-annotations-further">
|
||||
<section xml:id="hibernate-gsg-tutorial-annotations-further">
|
||||
<title>Take it further!</title>
|
||||
<itemizedlist>
|
||||
<title>Practice Exercises</title>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
|
||||
<chapter id="hibernate-gsg-tutorial-envers">
|
||||
<chapter xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Tutorial Using Envers</title>
|
||||
|
||||
<para>
|
||||
|
@ -21,7 +20,7 @@
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-envers-config">
|
||||
<section xml:id="hibernate-gsg-tutorial-envers-config">
|
||||
<title><filename>persistence.xml</filename></title>
|
||||
<para>
|
||||
This file was discussed in the <systemitem>JPA</systemitem> tutorial in <xref
|
||||
|
@ -29,7 +28,7 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-envers-entity">
|
||||
<section xml:id="hibernate-gsg-tutorial-envers-entity">
|
||||
<title>The annotated entity Java class</title>
|
||||
<para>
|
||||
Again, the entity is largely the same as in <xref linkend="hibernate-gsg-tutorial-jpa-entity" />. The major
|
||||
|
@ -38,14 +37,14 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-envers-test">
|
||||
<section xml:id="hibernate-gsg-tutorial-envers-test">
|
||||
<title>Example code</title>
|
||||
<para>
|
||||
Again, this tutorial makes use of the <systemitem>JPA</systemitem> APIs. However, the code also makes a change to one
|
||||
of the entities, then uses the Envers API to pull back the initial <firstterm>revision</firstterm> as well as the updated
|
||||
revision. A revision refers to a version of an entity.
|
||||
</para>
|
||||
<example id="hibernate-gsg-tutorial-envers-test-api">
|
||||
<example xml:id="hibernate-gsg-tutorial-envers-test-api">
|
||||
<title>Using the <interfacename>org.hibernate.envers.AuditReader</interfacename></title>
|
||||
<programlisting role="JAVA">public void testBasicUsage() {
|
||||
...
|
||||
|
@ -75,7 +74,7 @@
|
|||
</procedure>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-annotations-further">
|
||||
<section xml:id="hibernate-gsg-tutorial-annotations-further">
|
||||
<title>Take it further!</title>
|
||||
<itemizedlist>
|
||||
<title>Practice Exercises</title>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
|
||||
<chapter id="hibernate-gsg-tutorial-jpa">
|
||||
<chapter xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Tutorial Using the <firstterm><phrase>Java Persistence API (JPA)</phrase></firstterm></title>
|
||||
|
||||
<para>
|
||||
|
@ -21,7 +20,7 @@
|
|||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-jpa-config">
|
||||
<section xml:id="hibernate-gsg-tutorial-jpa-config">
|
||||
<title><filename>persistence.xml</filename></title>
|
||||
|
||||
<para>
|
||||
|
@ -34,7 +33,7 @@
|
|||
by classpath lookup of the <filename>META-INF/persistence.xml</filename> resource name.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-jpa-config-pu">
|
||||
<example xml:id="hibernate-gsg-tutorial-jpa-config-pu">
|
||||
<title><filename>persistence.xml</filename></title>
|
||||
<programlisting role="XML"><![CDATA[<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
|
@ -65,20 +64,20 @@
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-jpa-entity">
|
||||
<section xml:id="hibernate-gsg-tutorial-jpa-entity">
|
||||
<title>The annotated entity Java class</title>
|
||||
<para>
|
||||
The entity is exactly the same as in <xref linkend="hibernate-gsg-tutorial-annotations-entity"/>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-jpa-test">
|
||||
<section xml:id="hibernate-gsg-tutorial-jpa-test">
|
||||
<title>Example code</title>
|
||||
<para>
|
||||
The previous tutorials used the Hibernate APIs. This tutorial uses the <systemitem>JPA</systemitem> APIs.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-jpa-test-setUp">
|
||||
<example xml:id="hibernate-gsg-tutorial-jpa-test-setUp">
|
||||
<title>Obtaining the <interfacename>javax.persistence.EntityManagerFactory</interfacename></title>
|
||||
<programlisting role="JAVA">protected void setUp() throws Exception {
|
||||
entityManagerFactory = Persistence.createEntityManagerFactory( "org.hibernate.tutorial.jpa" );
|
||||
|
@ -90,7 +89,7 @@
|
|||
<xref linkend="hibernate-gsg-tutorial-jpa-config-pu"/>
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-jpa-test-saving">
|
||||
<example xml:id="hibernate-gsg-tutorial-jpa-test-saving">
|
||||
<title>Saving (persisting) entities</title>
|
||||
<programlisting role="JAVA">EntityManager entityManager = entityManagerFactory.createEntityManager();
|
||||
entityManager.getTransaction().begin();
|
||||
|
@ -107,7 +106,7 @@ entityManager.close();</programlisting>
|
|||
operation <methodname>persist</methodname> instead of <methodname>save</methodname>.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-jpa-test-list">
|
||||
<example xml:id="hibernate-gsg-tutorial-jpa-test-list">
|
||||
<title>Obtaining a list of entities</title>
|
||||
<programlisting role="JAVA"><![CDATA[entityManager = entityManagerFactory.createEntityManager();
|
||||
entityManager.getTransaction().begin();
|
||||
|
@ -124,7 +123,7 @@ entityManager.close();]]></programlisting>
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-annotations-further">
|
||||
<section xml:id="hibernate-gsg-tutorial-annotations-further">
|
||||
<title>Take it further!</title>
|
||||
<itemizedlist>
|
||||
<title>Practice Exercises</title>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
|
||||
|
||||
<chapter id="hibernate-gsg-tutorial-basic">
|
||||
<chapter xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Tutorial Using Native Hibernate APIs and <phrase>hbm.xml</phrase> Mappings</title>
|
||||
|
||||
<para>
|
||||
|
@ -22,7 +21,7 @@
|
|||
</itemizedlist>
|
||||
|
||||
|
||||
<section id="hibernate-gsg-tutorial-basic-config">
|
||||
<section xml:id="hibernate-gsg-tutorial-basic-config">
|
||||
<title>The Hibernate configuration file</title>
|
||||
|
||||
<para>
|
||||
|
@ -74,7 +73,7 @@
|
|||
</section>
|
||||
|
||||
|
||||
<section id="hibernate-gsg-tutorial-basic-entity">
|
||||
<section xml:id="hibernate-gsg-tutorial-basic-entity">
|
||||
<title>The entity Java class</title>
|
||||
<para>
|
||||
The entity class for this tutorial is <classname>org.hibernate.tutorial.hbm.Event</classname>.
|
||||
|
@ -99,7 +98,7 @@
|
|||
</section>
|
||||
|
||||
|
||||
<section id="hibernate-gsg-tutorial-basic-mapping">
|
||||
<section xml:id="hibernate-gsg-tutorial-basic-mapping">
|
||||
<title>The mapping file</title>
|
||||
<para>
|
||||
The <filename>hbm.xml</filename> mapping file for this tutorial is the classpath resource
|
||||
|
@ -112,7 +111,7 @@
|
|||
Hibernate mapping file is one choice for providing Hibernate with this metadata.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-basic-mapping-class">
|
||||
<example xml:id="hibernate-gsg-tutorial-basic-mapping-class">
|
||||
<title>The <literal>class</literal> mapping element</title>
|
||||
<programlisting role="XML"><![CDATA[<class name="Event" table="EVENTS">
|
||||
...
|
||||
|
@ -141,7 +140,7 @@
|
|||
<database class="table">EVENTS</database> table.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-basic-mapping-id">
|
||||
<example xml:id="hibernate-gsg-tutorial-basic-mapping-id">
|
||||
<title>The <literal>id</literal> mapping element</title>
|
||||
<programlisting role="XML"><![CDATA[<id name="id" column="EVENT_ID">
|
||||
...
|
||||
|
@ -175,7 +174,7 @@
|
|||
incrementing count.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-basic-mapping-property">
|
||||
<example xml:id="hibernate-gsg-tutorial-basic-mapping-property">
|
||||
<title>The <literal>property</literal> mapping element</title>
|
||||
<programlisting role="XML"><![CDATA[<property name="date" type="timestamp" column="EVENT_DATE"/>
|
||||
<property name="title"/>]]></programlisting>
|
||||
|
@ -219,7 +218,7 @@
|
|||
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-basic-test">
|
||||
<section xml:id="hibernate-gsg-tutorial-basic-test">
|
||||
<title>Example code</title>
|
||||
<para>
|
||||
The <classname>org.hibernate.tutorial.hbm.NativeApiIllustrationTest</classname> class illustrates using
|
||||
|
@ -234,7 +233,7 @@
|
|||
</para>
|
||||
</note>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-basic-test-setUp">
|
||||
<example xml:id="hibernate-gsg-tutorial-basic-test-setUp">
|
||||
<title>Obtaining the <interfacename>org.hibernate.SessionFactory</interfacename></title>
|
||||
<programlisting role="JAVA">protected void setUp() throws Exception {
|
||||
// A SessionFactory is set up once for an application
|
||||
|
@ -280,7 +279,7 @@
|
|||
</step>
|
||||
</procedure>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-basic-test-saving">
|
||||
<example xml:id="hibernate-gsg-tutorial-basic-test-saving">
|
||||
<title>Saving entities</title>
|
||||
<programlisting role="JAVA">Session session = sessionFactory.openSession();
|
||||
session.beginTransaction();
|
||||
|
@ -296,7 +295,7 @@ session.close();</programlisting>
|
|||
takes responsibility to perform an <command>INSERT</command> on the database.
|
||||
</para>
|
||||
|
||||
<example id="hibernate-gsg-tutorial-basic-test-list">
|
||||
<example xml:id="hibernate-gsg-tutorial-basic-test-list">
|
||||
<title>Obtaining a list of entities</title>
|
||||
<programlisting role="JAVA"><![CDATA[session = sessionFactory.openSession();
|
||||
session.beginTransaction();
|
||||
|
@ -316,7 +315,7 @@ session.close();]]></programlisting>
|
|||
</para>
|
||||
</section>
|
||||
|
||||
<section id="hibernate-gsg-tutorial-annotations-further">
|
||||
<section xml:id="hibernate-gsg-tutorial-annotations-further">
|
||||
<title>Take it further!</title>
|
||||
<itemizedlist>
|
||||
<title>Practice Exercises</title>
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
@import url("hibernate.css");
|
||||
|
||||
body {background-image:none;}
|
|
@ -0,0 +1,3 @@
|
|||
@import url("hibernate.css");
|
||||
|
||||
.title {margin-top:30px;}
|
|
@ -0,0 +1,94 @@
|
|||
@import url("jbossorg.css");
|
||||
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
/* work around problems in the jboss.org styles wrt html & jHighLight */
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
pre {
|
||||
font-family:Monaco,monospace;
|
||||
line-height: 1.29em;
|
||||
}
|
||||
|
||||
pre br {
|
||||
display:none;
|
||||
}
|
||||
|
||||
pre.JAVA {
|
||||
line-height: 1.29em;
|
||||
}
|
||||
|
||||
pre.XML {
|
||||
line-height: 1.29em;
|
||||
}
|
||||
|
||||
pre.JSP {
|
||||
line-height: 1.29em;
|
||||
}
|
||||
|
||||
pre.XHTML {
|
||||
line-height: 1.29em;
|
||||
}
|
||||
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
body{
|
||||
background-image:url(../images/org/hibernate/bkg_gradient.png);
|
||||
font-family:'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a{
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
h1{
|
||||
background-image:url(../images/org/hibernate/title_hdr.png);
|
||||
color:#182737;
|
||||
}
|
||||
|
||||
h2,h3,h4,h5,h6{
|
||||
color:#4a5d75;
|
||||
}
|
||||
|
||||
#title a.site_href {
|
||||
display:block;
|
||||
height:100px;
|
||||
width:362px;
|
||||
float:left;
|
||||
background:url(../images/org/hibernate/hibernatelogo.png) top left no-repeat;
|
||||
}
|
||||
|
||||
#title a.doc_href {
|
||||
display:block;
|
||||
height:100px;
|
||||
background:transparent url(../images/org/hibernate/community_doc.png) top right no-repeat;
|
||||
}
|
||||
|
||||
.releaseinfo {
|
||||
color:#4a5d75;
|
||||
font-size:150%;
|
||||
}
|
||||
|
||||
div.note {
|
||||
background-color:#849092;
|
||||
color:white;
|
||||
}
|
||||
|
||||
div.note h2 {color:white;}
|
||||
|
||||
div.note a:visited, div.tip a:visited, div.important a:visited, div.caution a:visited, div.warning a:visited, div.note a:link, div.tip a:link, div.important a:link, div.caution a:link, div.warning a:link {
|
||||
color: #f7f2d0;
|
||||
}
|
||||
|
||||
.docnav li.next a strong {background-image:url(../images/org/hibernate/docbook/next.png);}
|
||||
.docnav li.previous a strong {background-image:url(../images/org/hibernate/docbook/prev.png);}
|
||||
.docnav li.home a strong {background-image:url(../images/org/hibernate/docbook/home.png);}
|
||||
.docnav li.up a strong {background-image:url(../images/org/hibernate/docbook/up.png);}
|
||||
|
||||
/* Eclipse Help Navigation */
|
||||
.navheader td.next a {background-image:url(../images/org/hibernate/docbook/next.png);}
|
||||
.navheader td.previous a {background-image:url(../images/org/hibernate/docbook/prev.png);}
|
||||
|
||||
.navfooter td.next a {background-image:url(../images/org/hibernate/docbook/next.png);}
|
||||
.navfooter td.previous a {background-image:url(../images/org/hibernate/docbook/prev.png);}
|
||||
.navfooter td.home a {background-image:url(../images/org/hibernate/docbook/home.png);}
|
||||
.navfooter td.up a {background-image:url(../images/org/hibernate/docbook/up.png);}
|
||||
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 606 B |
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.466 -0.607 17 17" enable-background="new -0.466 -0.607 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.5347" y1="7.9844" x2="19.5342" y2="7.9844">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.984" cy="7.984" r="7.484"/>
|
||||
<path fill="#EDF1F2" d="M9.78,4.354v7.951H8.688V6.655h-1.83V5.861C7.365,5.85,8.653,5.815,8.94,4.354H9.78z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1018 B |
After Width: | Height: | Size: 713 B |
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.354 -0.908 17 17" enable-background="new -0.354 -0.908 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.646" y1="7.9839" x2="18.6455" y2="7.9839">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.984" cy="7.983" r="7.484"/>
|
||||
<path fill="#EDF1F2" d="M5.11,4.067v7.95H4.018V6.368h-1.83V5.574c0.506-0.011,1.795-0.046,2.083-1.507H5.11z"/>
|
||||
<path fill="#EDF1F2" d="M10.596,12.098c-0.656,0-1.634-0.149-2.313-1.254c-0.506-0.84-0.586-1.921-0.586-2.784
|
||||
c0-0.518,0.023-1.013,0.115-1.495c0.356-1.956,1.588-2.681,2.864-2.681c0.449,0,0.897,0.092,1.289,0.287
|
||||
c1.173,0.633,1.553,2.036,1.553,3.739C13.518,8.67,13.518,12.098,10.596,12.098z M12.401,7.864c0-0.852-0.046-3.095-1.76-3.095
|
||||
c-0.311,0-0.621,0.092-0.863,0.253C9.019,5.54,8.812,6.69,8.812,8.025c0,0.84,0.047,3.164,1.807,3.164
|
||||
C12.24,11.189,12.401,9.245,12.401,7.864z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 668 B |
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.466 -0.607 17 17" enable-background="new -0.466 -0.607 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.5347" y1="7.9844" x2="19.5342" y2="7.9844">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.984" cy="7.984" r="7.484"/>
|
||||
<path fill="#EDF1F2" d="M5.923,4.355v7.95H4.83V6.656H3V5.863c0.506-0.012,1.795-0.047,2.083-1.508H5.923z"/>
|
||||
<path fill="#EDF1F2" d="M10.237,4.355v7.95H9.146V6.656h-1.83V5.863C7.821,5.852,9.11,5.816,9.397,4.355H10.237z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 743 B |
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.466 -0.308 17 17" enable-background="new -0.466 -0.308 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.5347" y1="7.9834" x2="19.5342" y2="7.9834">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.984" cy="7.984" r="7.484"/>
|
||||
<path fill="#EDF1F2" d="M4.849,4.355v7.95H3.756V6.656h-1.83V5.862c0.506-0.011,1.795-0.046,2.083-1.507H4.849z"/>
|
||||
<path fill="#EDF1F2" d="M13.164,11.305v1.001H7.7v-1.104l0.184-0.161c0.265-0.241,0.529-0.483,0.794-0.713
|
||||
c0.276-0.254,0.575-0.495,0.851-0.736c1.508-1.277,2.29-1.979,2.29-3.015c0-0.288-0.104-1.369-1.461-1.369
|
||||
c-1.174,0-1.427,0.84-1.507,1.185C8.77,6.749,8.781,7.002,8.792,7.267L7.677,7.209c0-0.288,0-0.736,0.16-1.242
|
||||
c0.369-1.128,1.301-1.715,2.566-1.715c1.795,0,2.531,1.128,2.531,2.278c0,1.196-0.668,2.105-2.256,3.405
|
||||
c-0.275,0.219-0.54,0.438-0.816,0.656c-0.115,0.104-0.701,0.598-0.84,0.713H13.164z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 714 B |
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="16px" viewBox="-0.466 -0.008 17 16" enable-background="new -0.466 -0.008 17 16"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.5347" y1="7.9839" x2="19.5342" y2="7.9839">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.984" cy="7.984" r="7.484"/>
|
||||
<path fill="#EDF1F2" d="M4.849,4.354v7.95H3.756V6.655h-1.83V5.861c0.506-0.011,1.795-0.046,2.083-1.507H4.849z"/>
|
||||
<path fill="#EDF1F2" d="M9.679,7.622c0.438,0.012,1.081,0.034,1.473-0.161c0.241-0.127,0.621-0.426,0.621-1.047
|
||||
c0-0.828-0.645-1.22-1.404-1.22c-0.562,0-0.932,0.195-1.139,0.38C8.792,5.966,8.735,6.575,8.712,6.852L7.653,6.782
|
||||
C7.723,5.977,7.976,5.286,8.597,4.78c0.334-0.265,0.909-0.552,1.795-0.552c1.737,0,2.485,1.093,2.485,2.128
|
||||
c0,0.483-0.173,0.943-0.46,1.254c-0.254,0.265-0.529,0.392-0.69,0.46c1.035,0.265,1.438,1.174,1.438,1.91s-0.356,1.438-0.908,1.853
|
||||
c-0.322,0.265-0.955,0.587-2.002,0.587c-0.438,0-1.243-0.046-1.921-0.563c-0.91-0.68-0.979-1.681-1.001-2.152l1.082-0.092
|
||||
c0,0.173,0.012,0.483,0.16,0.852c0.415,0.989,1.301,1.013,1.646,1.013c1.794,0,1.829-1.347,1.829-1.53
|
||||
c0-0.23-0.046-0.46-0.161-0.667c-0.38-0.668-1.186-0.702-1.691-0.702c-0.069,0-0.219,0-0.518,0.012V7.622z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 723 B |
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.466 -0.708 17 17" enable-background="new -0.466 -0.708 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.5347" y1="7.9839" x2="19.5342" y2="7.9839">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.984" cy="7.983" r="7.484"/>
|
||||
<path fill="#EDF1F2" d="M4.849,4.354v7.95H3.756V6.655h-1.83V5.862c0.506-0.012,1.795-0.047,2.083-1.508H4.849z"/>
|
||||
<path fill="#EDF1F2" d="M11.91,9.544h1.197v0.932H11.91v1.829h-1.069v-1.829H7.366V9.371l3.694-5.028h0.851V9.544z M10.841,9.544
|
||||
l0.068-3.59l-2.508,3.59H10.841z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 762 B |
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.587 -0.408 17 17" enable-background="new -0.587 -0.408 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="1.4136" y1="7.9844" x2="19.4131" y2="7.9844">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.985" cy="7.983" r="7.485"/>
|
||||
<path fill="#EDF1F2" d="M4.728,4.354v7.95H3.635V6.655h-1.83V5.861c0.506-0.011,1.795-0.046,2.083-1.507H4.728z"/>
|
||||
<path fill="#EDF1F2" d="M12.768,4.366v0.989h-3.59L8.845,7.473c0.494-0.356,0.977-0.506,1.599-0.506c1.68,0,2.646,1.265,2.646,2.691
|
||||
c0,1.68-1.22,2.784-2.877,2.784c-0.655,0-1.357-0.195-1.817-0.575c-0.748-0.598-0.84-1.495-0.875-1.875l1.093-0.069
|
||||
c0.012,0.173,0.034,0.449,0.16,0.714c0.242,0.54,0.783,0.852,1.473,0.852c1.231,0,1.738-0.967,1.738-1.818
|
||||
c0-0.955-0.621-1.771-1.761-1.771c-0.932,0-1.369,0.494-1.622,0.794L7.693,8.646l0.61-4.28H12.768z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 704 B |
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.232 -0.308 17 17" enable-background="new -0.232 -0.308 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.7681" y1="7.9834" x2="18.7676" y2="7.9834">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.985" cy="7.984" r="7.485"/>
|
||||
<path fill="#EDF1F2" d="M10.866,11.304v1H5.402V11.2l0.184-0.162c0.265-0.241,0.529-0.482,0.794-0.713
|
||||
c0.276-0.253,0.575-0.494,0.851-0.736c1.507-1.277,2.29-1.979,2.29-3.014c0-0.288-0.104-1.369-1.461-1.369
|
||||
c-1.174,0-1.427,0.84-1.507,1.185C6.472,6.747,6.483,7,6.495,7.265L5.379,7.208c0-0.288,0-0.736,0.161-1.243
|
||||
C5.908,4.837,6.84,4.25,8.105,4.25c1.795,0,2.531,1.127,2.531,2.278c0,1.197-0.668,2.105-2.256,3.406
|
||||
c-0.275,0.219-0.54,0.437-0.816,0.655c-0.115,0.104-0.702,0.599-0.84,0.714H10.866z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 691 B |
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="16px" viewBox="-0.232 -0.008 17 16" enable-background="new -0.232 -0.008 17 16"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.7681" y1="7.9839" x2="18.7676" y2="7.9839">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.985" cy="7.984" r="7.485"/>
|
||||
<path fill="#EDF1F2" d="M7.38,7.621C7.818,7.633,8.462,7.656,8.854,7.46c0.241-0.126,0.621-0.426,0.621-1.047
|
||||
c0-0.828-0.645-1.22-1.404-1.22c-0.563,0-0.931,0.196-1.139,0.38C6.495,5.964,6.437,6.574,6.414,6.85L5.355,6.781
|
||||
c0.069-0.805,0.322-1.496,0.944-2.002c0.333-0.265,0.909-0.552,1.794-0.552c1.737,0,2.485,1.093,2.485,2.128
|
||||
c0,0.483-0.173,0.943-0.46,1.254C9.865,7.874,9.59,8.001,9.429,8.07c1.035,0.264,1.438,1.173,1.438,1.909s-0.356,1.438-0.909,1.853
|
||||
c-0.321,0.265-0.954,0.587-2.001,0.587c-0.438,0-1.243-0.046-1.921-0.563c-0.909-0.68-0.978-1.68-1.001-2.152l1.082-0.092
|
||||
c0,0.173,0.011,0.483,0.161,0.852c0.415,0.989,1.3,1.013,1.646,1.013c1.795,0,1.828-1.347,1.828-1.53c0-0.23-0.045-0.461-0.16-0.668
|
||||
C9.21,8.61,8.404,8.576,7.898,8.576c-0.069,0-0.219,0-0.518,0.012V7.621z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 671 B |
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.232 -0.708 17 17" enable-background="new -0.232 -0.708 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.7681" y1="7.9839" x2="18.7676" y2="7.9839">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.985" cy="7.983" r="7.485"/>
|
||||
<path fill="#EDF1F2" d="M9.613,9.542h1.196v0.933H9.613v1.829h-1.07v-1.829H5.068V9.37l3.694-5.028h0.852V9.542z M8.543,9.542
|
||||
l0.068-3.589L6.104,9.542H8.543z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 718 B |
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.232 -0.408 17 17" enable-background="new -0.232 -0.408 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.7681" y1="7.9844" x2="18.7676" y2="7.9844">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.985" cy="7.983" r="7.485"/>
|
||||
<path fill="#EDF1F2" d="M10.59,4.365v0.989H7.001L6.667,7.471c0.495-0.357,0.978-0.506,1.599-0.506c1.68,0,2.646,1.266,2.646,2.692
|
||||
c0,1.68-1.22,2.784-2.877,2.784c-0.656,0-1.357-0.195-1.817-0.575c-0.748-0.599-0.84-1.496-0.875-1.876l1.093-0.068
|
||||
c0.012,0.172,0.035,0.448,0.161,0.713c0.242,0.541,0.782,0.852,1.472,0.852c1.231,0,1.738-0.967,1.738-1.818
|
||||
c0-0.954-0.621-1.771-1.761-1.771c-0.932,0-1.369,0.495-1.622,0.794L5.517,8.645l0.61-4.28H10.59z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 724 B |
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.232 -0.107 17 17" enable-background="new -0.232 -0.107 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.7681" y1="7.9844" x2="18.7676" y2="7.9844">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.985" cy="7.984" r="7.485"/>
|
||||
<path fill="#EDF1F2" d="M9.82,6.437C9.809,6.275,9.797,6.091,9.67,5.838c-0.391-0.759-1.115-0.759-1.3-0.759
|
||||
c-0.472,0-1.093,0.115-1.53,0.943C6.437,6.77,6.403,7.553,6.368,8.174C6.483,7.99,6.61,7.76,6.966,7.506
|
||||
C7.507,7.115,8.07,7.035,8.474,7.035c1.461,0,2.543,1.059,2.543,2.68c0,1.52-1.036,2.658-2.704,2.658
|
||||
c-1.254,0-2.094-0.598-2.554-1.61C5.586,10.371,5.333,9.67,5.333,8.323c0-1.3,0.276-2.658,1.266-3.509
|
||||
C7.22,4.273,7.887,4.17,8.393,4.17c1.496,0,2.336,0.943,2.463,2.198L9.82,6.437z M8.336,7.99c-0.909,0-1.692,0.655-1.692,1.691
|
||||
c0,0.816,0.495,1.76,1.68,1.76c0.955,0,1.622-0.702,1.622-1.727C9.946,8.635,9.244,7.99,8.336,7.99z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 670 B |
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 13.0.1, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="17px" height="17px" viewBox="-0.232 -0.808 17 17" enable-background="new -0.232 -0.808 17 17"
|
||||
xml:space="preserve">
|
||||
<defs>
|
||||
</defs>
|
||||
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="0.7681" y1="7.9839" x2="18.7676" y2="7.9839">
|
||||
<stop offset="0" style="stop-color:#243446"/>
|
||||
<stop offset="1" style="stop-color:#506167"/>
|
||||
</linearGradient>
|
||||
<circle fill="url(#SVGID_1_)" stroke="#919B9E" cx="7.985" cy="7.984" r="7.485"/>
|
||||
<path fill="#EDF1F2" d="M5.436,5.39V4.343h5.235v0.92c-0.368,0.391-0.897,0.966-1.587,2.232c-0.622,1.127-1.186,2.404-1.496,4.809
|
||||
H6.391c0.069-0.609,0.207-1.139,0.253-1.369c0.208-0.816,0.449-1.553,0.829-2.381C8.348,6.575,9.141,5.723,9.451,5.39H5.436z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 733 B |