HHH-4933 use jHighlighter to align with core
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18934 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
37dae12a8b
commit
afac90b244
|
@ -122,7 +122,7 @@
|
|||
<literal>ddl</literal> together by setting the property to
|
||||
<literal>callback, dll</literal></para>
|
||||
|
||||
<programlisting><persistence ...>
|
||||
<programlisting role="XML" language="XML"><persistence ...>
|
||||
<persistence-unit ...>
|
||||
...
|
||||
<properties>
|
||||
|
@ -171,15 +171,15 @@
|
|||
<example>
|
||||
<title>Using custom groups for validation</title>
|
||||
|
||||
<programlisting><persistence ...>
|
||||
<programlisting role="XML" language="XML"><persistence ...>
|
||||
<persistence-unit ...>
|
||||
...
|
||||
<properties>
|
||||
<property name="<literal>javax.persistence.validation.group.pre-update</literal>"
|
||||
<property name="javax.persistence.validation.group.pre-update"
|
||||
value="javax.validation.group.Default, com.acme.group.Strict"/>
|
||||
<property name="<literal>javax.persistence.validation.group.pre-remove</literal>"
|
||||
<property name="javax.persistence.validation.group.pre-remove"
|
||||
value="com.acme.group.OnDelete"/>
|
||||
<property name="<literal>org.hibernate.validator.group.ddl</literal>"
|
||||
<property name="org.hibernate.validator.group.ddl"
|
||||
value="com.acme.group.DDL"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,7 +46,7 @@
|
|||
<para>Alternatively add the following dependency in your dependency
|
||||
manager (like Maven or Ivy). Here is an example</para>
|
||||
|
||||
<programlisting><project ...>
|
||||
<programlisting role="XML" language="XML"><project ...>
|
||||
...
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -97,7 +97,8 @@
|
|||
<filename>hibernate-validator.jar</filename> and
|
||||
<filename>validation-api.jar</filename> in your classpath. Alternatively
|
||||
add the following dependency in your
|
||||
<filename>pom.xml</filename>.<programlisting><project>
|
||||
<filename>pom.xml</filename>.</para>
|
||||
<programlisting role="XML" language="XML"><project>
|
||||
...
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -108,7 +109,7 @@
|
|||
...
|
||||
</dependencies>
|
||||
...
|
||||
</project></programlisting></para>
|
||||
</project></programlisting>
|
||||
|
||||
<para>If you wish to use <ulink
|
||||
url="http://search.hibernate.org">Hibernate Search</ulink>, download it
|
||||
|
@ -116,7 +117,7 @@
|
|||
<filename>hibernate-search.jar</filename> and
|
||||
<filename>lucene-core-x.y.z.jar</filename> in your classpath.
|
||||
Alternatively add the following dependency in your
|
||||
<filename>pom.xml</filename>.<programlisting><project>
|
||||
<filename>pom.xml</filename>.</para><programlisting role="XML" language="XML"><project>
|
||||
...
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
@ -127,7 +128,7 @@
|
|||
...
|
||||
</dependencies>
|
||||
...
|
||||
</project></programlisting></para>
|
||||
</project></programlisting>
|
||||
|
||||
<para>We recommend you use the JPA 2 APIs to bootstrap Hibernate (see the
|
||||
Hibernate EntityManager documentation for more information). If you use
|
||||
|
@ -136,7 +137,8 @@
|
|||
<para>If you boot Hibernate yourself, make sure to use the
|
||||
<classname>AnnotationConfiguration</classname> class instead of the
|
||||
<classname>Configuration</classname> class. Here is an example using the
|
||||
(legacy) <classname>HibernateUtil</classname> approach: <programlisting>package hello;
|
||||
(legacy) <classname>HibernateUtil</classname> approach:</para>
|
||||
<programlisting role="JAVA" language="JAVA">package hello;
|
||||
|
||||
import org.hibernate.*;
|
||||
import org.hibernate.cfg.*;
|
||||
|
@ -146,12 +148,10 @@ import test.animals.Dog;
|
|||
public class HibernateUtil {
|
||||
|
||||
private static final SessionFactory sessionFactory;
|
||||
|
||||
static {
|
||||
try {
|
||||
|
||||
sessionFactory = new <emphasis role="bold">AnnotationConfiguration()</emphasis>
|
||||
configure().buildSessionFactory();
|
||||
.configure().buildSessionFactory();
|
||||
} catch (Throwable ex) {
|
||||
// Log exception!
|
||||
throw new ExceptionInInitializerError(ex);
|
||||
|
@ -163,7 +163,7 @@ private static final SessionFactory sessionFactory;
|
|||
return sessionFactory.openSession();
|
||||
}
|
||||
}
|
||||
</programlisting></para>
|
||||
</programlisting>
|
||||
|
||||
<para>Interesting here is the use of
|
||||
<classname>AnnotationConfiguration</classname>. The packages and annotated
|
||||
|
@ -171,20 +171,20 @@ private static final SessionFactory sessionFactory;
|
|||
<filename>hibernate.cfg.xml</filename>). Here is the equivalent of the
|
||||
above declaration:</para>
|
||||
|
||||
<programlisting><!DOCTYPE hibernate-configuration PUBLIC
|
||||
<programlisting role="XML" language="XML"><!DOCTYPE hibernate-configuration PUBLIC
|
||||
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
|
||||
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
||||
|
||||
<hibernate-configuration>
|
||||
<session-factory>
|
||||
<emphasis role="bold"><mapping package="test.animals"/>
|
||||
<mapping package="test.animals"/>
|
||||
<mapping class="test.Flight"/>
|
||||
<mapping class="test.Sky"/>
|
||||
<mapping class="test.Person"/>
|
||||
<mapping class="test.animals.Dog"/></emphasis>
|
||||
<emphasis role="bold"> <mapping resource="test/animals/orm.xml"/></emphasis>
|
||||
<mapping class="test.animals.Dog"/>
|
||||
|
||||
<mapping resource="test/animals/orm.xml"/>
|
||||
</session-factory>
|
||||
</hibernate-configuration> </programlisting>
|
||||
</hibernate-configuration></programlisting>
|
||||
|
||||
<para>Note that you can mix the legacy hbm.xml use and the annotation
|
||||
approach. The resource element can be either an hbm file or an EJB3 XML
|
||||
|
@ -194,13 +194,13 @@ private static final SessionFactory sessionFactory;
|
|||
<para>Alternatively, you can define the annotated classes and packages
|
||||
using the programmatic API</para>
|
||||
|
||||
<programlisting>sessionFactory = new <emphasis role="bold">AnnotationConfiguration()
|
||||
<programlisting role="JAVA" language="JAVA">sessionFactory = new <emphasis role="bold">AnnotationConfiguration()
|
||||
.addPackage("test.animals") //the fully qualified package name
|
||||
.addAnnotatedClass(Flight.class)
|
||||
.addAnnotatedClass(Sky.class)
|
||||
.addAnnotatedClass(Person.class)
|
||||
.addAnnotatedClass(Dog.class)</emphasis>
|
||||
<emphasis role="bold"> .addResource("test/animals/orm.xml")</emphasis>
|
||||
.addAnnotatedClass(Dog.class)
|
||||
.addResource("test/animals/orm.xml")</emphasis>
|
||||
.configure()
|
||||
.buildSessionFactory();</programlisting>
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
<para>You can define global level metadata available for all XML files.
|
||||
You must not define these metadata more than once per deployment.</para>
|
||||
|
||||
<programlisting><?xml version="1.0" encoding="UTF-8"?>
|
||||
<programlisting role="XML" language="XML"><?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<entity-mappings
|
||||
xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
|
@ -347,7 +347,7 @@
|
|||
<literal>mapped-superclass/attributes</literal> or
|
||||
<literal>embeddable/attributes</literal>.</para>
|
||||
|
||||
<programlisting> <attributes>
|
||||
<programlisting role="XML" language="XML"> <attributes>
|
||||
<id name="id">
|
||||
<column name="fld_id"/>
|
||||
<generated-value generator="generator" strategy="SEQUENCE"/>
|
||||
|
@ -388,7 +388,7 @@
|
|||
<literal>mapped-superclass/attributes</literal> or
|
||||
<literal>embeddable/attributes</literal>.</para>
|
||||
|
||||
<programlisting> <attributes>
|
||||
<programlisting role="XML" language="XML"> <attributes>
|
||||
<one-to-many name="players" fetch="EAGER">
|
||||
<map-key name="name"/>
|
||||
<join-column name="driver"/>
|
||||
|
|
Loading…
Reference in New Issue