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:
Emmanuel Bernard 2010-03-08 18:24:20 +00:00
parent 37dae12a8b
commit afac90b244
4 changed files with 205 additions and 207 deletions

View File

@ -122,7 +122,7 @@
<literal>ddl</literal> together by setting the property to
<literal>callback, dll</literal></para>
<programlisting>&lt;persistence ...&gt;
<programlisting role="XML" language="XML">&lt;persistence ...&gt;
&lt;persistence-unit ...&gt;
...
&lt;properties&gt;
@ -171,15 +171,15 @@
<example>
<title>Using custom groups for validation</title>
<programlisting>&lt;persistence ...&gt;
<programlisting role="XML" language="XML">&lt;persistence ...&gt;
&lt;persistence-unit ...&gt;
...
&lt;properties&gt;
&lt;property name="<literal>javax.persistence.validation.group.pre-update</literal>"
&lt;property name="javax.persistence.validation.group.pre-update"
value="javax.validation.group.Default, com.acme.group.Strict"/&gt;
&lt;property name="<literal>javax.persistence.validation.group.pre-remove</literal>"
&lt;property name="javax.persistence.validation.group.pre-remove"
value="com.acme.group.OnDelete"/&gt;
&lt;property name="<literal>org.hibernate.validator.group.ddl</literal>"
&lt;property name="org.hibernate.validator.group.ddl"
value="com.acme.group.DDL"/&gt;
&lt;/properties&gt;
&lt;/persistence-unit&gt;

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@
<para>Alternatively add the following dependency in your dependency
manager (like Maven or Ivy). Here is an example</para>
<programlisting>&lt;project ...&gt;
<programlisting role="XML" language="XML">&lt;project ...&gt;
...
&lt;dependencies&gt;
&lt;dependency&gt;
@ -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>&lt;project&gt;
<filename>pom.xml</filename>.</para>
<programlisting role="XML" language="XML">&lt;project&gt;
...
&lt;dependencies&gt;
&lt;dependency&gt;
@ -108,7 +109,7 @@
...
&lt;/dependencies&gt;
...
&lt;/project&gt;</programlisting></para>
&lt;/project&gt;</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>&lt;project&gt;
<filename>pom.xml</filename>.</para><programlisting role="XML" language="XML">&lt;project&gt;
...
&lt;dependencies&gt;
&lt;dependency&gt;
@ -127,7 +128,7 @@
...
&lt;/dependencies&gt;
...
&lt;/project&gt;</programlisting></para>
&lt;/project&gt;</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>&lt;!DOCTYPE hibernate-configuration PUBLIC
<programlisting role="XML" language="XML">&lt;!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
&lt;hibernate-configuration&gt;
&lt;session-factory&gt;
<emphasis role="bold">&lt;mapping package="test.animals"/&gt;
&lt;mapping package="test.animals"/&gt;
&lt;mapping class="test.Flight"/&gt;
&lt;mapping class="test.Sky"/&gt;
&lt;mapping class="test.Person"/&gt;
&lt;mapping class="test.animals.Dog"/&gt;</emphasis>
<emphasis role="bold"> &lt;mapping resource="test/animals/orm.xml"/&gt;</emphasis>
&lt;mapping class="test.animals.Dog"/&gt;
&lt;mapping resource="test/animals/orm.xml"/&gt;
&lt;/session-factory&gt;
&lt;/hibernate-configuration&gt; </programlisting>
&lt;/hibernate-configuration&gt;</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>

View File

@ -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>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<programlisting role="XML" language="XML">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;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> &lt;attributes&gt;
<programlisting role="XML" language="XML"> &lt;attributes&gt;
&lt;id name="id"&gt;
&lt;column name="fld_id"/&gt;
&lt;generated-value generator="generator" strategy="SEQUENCE"/&gt;
@ -388,7 +388,7 @@
<literal>mapped-superclass/attributes</literal> or
<literal>embeddable/attributes</literal>.</para>
<programlisting> &lt;attributes&gt;
<programlisting role="XML" language="XML"> &lt;attributes&gt;
&lt;one-to-many name="players" fetch="EAGER"&gt;
&lt;map-key name="name"/&gt;
&lt;join-column name="driver"/&gt;