moved some misplaced JPA sections

This commit is contained in:
Thomas Risberg 2009-06-26 03:45:48 +00:00
parent 9eacd10615
commit 6bb5bdd0c6
1 changed files with 66 additions and 65 deletions

View File

@ -1814,66 +1814,21 @@ public class ProductDaoImpl implements ProductDao {
a non-invasiveness perspective, and might feel more natural to JPA a non-invasiveness perspective, and might feel more natural to JPA
developers.</para> developers.</para>
</section> </section>
</section>
<section id="orm-jpa-dialect"> <section id="orm-jpa-tx">
<title><interfacename>JpaDialect</interfacename></title> <title>Transaction Management</title>
<para>As an advanced feature <classname>JpaTemplate</classname>, <para>To execute service operations within transactions, you can use
<classname>JpaTransactionManager</classname> and subclasses of Spring's common declarative transaction facilities. For example:</para>
<classname>AbstractEntityManagerFactoryBean</classname> support a custom
<interfacename>JpaDialect</interfacename>, to be passed into the
"jpaDialect" bean property. In such a scenario, the DAOs won't receive an
<interfacename>EntityManagerFactory</interfacename> reference but rather a
full <classname>JpaTemplate</classname> instance instead (for example,
passed into <classname>JpaDaoSupport</classname>'s "jpaTemplate"
property). A <interfacename>JpaDialect</interfacename> implementation can
enable some advanced features supported by Spring, usually in a
vendor-specific manner:</para>
<itemizedlist> <note>
<listitem> <para>You are <emphasis>strongly</emphasis> encouraged to read the
<para>applying specific transaction semantics (such as custom section entitled <xref linkend="transaction-declarative" /> if you
isolation level or transaction timeout)</para> have not done so to get a more detailed coverage of Spring's
</listitem> declarative transaction support.</para>
</note>
<listitem> <programlisting language="xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<para>retrieving the transactional JDBC
<interfacename>Connection</interfacename> (for exposure to JDBC-based
DAOs)</para>
</listitem>
<listitem>
<para>advanced translation of <literal>PersistenceExceptions</literal>
to Spring <literal>DataAccessExceptions</literal></para>
</listitem>
</itemizedlist>
<para>This is particularly valuable for special transaction semantics and
for advanced translation of exception. Note that the default
implementation used (<classname>DefaultJpaDialect</classname>) doesn't
provide any special capabilities and if the above features are required,
the appropriate dialect has to be specified.</para>
<para>See the <interfacename>JpaDialect</interfacename> Javadoc for more
details of its operations and how they are used within Spring's JPA
support.</para>
</section>
<section id="orm-jpa-tx">
<title>Transaction Management</title>
<para>To execute service operations within transactions, you can use
Spring's common declarative transaction facilities. For example:</para>
<note>
<para>You are <emphasis>strongly</emphasis> encouraged to read the
section entitled <xref linkend="transaction-declarative" /> if you have
not done so to get a more detailed coverage of Spring's declarative
transaction support.</para>
</note>
<programlisting language="xml">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans" &lt;beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:aop="http://www.springframework.org/schema/aop"
@ -1909,15 +1864,61 @@ public class ProductDaoImpl implements ProductDao {
&lt;/beans&gt;</programlisting> &lt;/beans&gt;</programlisting>
<para>Spring JPA allows a configured <para>Spring JPA allows a configured
<classname>JpaTransactionManager</classname> to expose a JPA transaction <classname>JpaTransactionManager</classname> to expose a JPA transaction
to JDBC access code that accesses the same JDBC to JDBC access code that accesses the same JDBC
<interfacename>DataSource</interfacename>, provided that the registered <interfacename>DataSource</interfacename>, provided that the registered
<interfacename>JpaDialect</interfacename> supports retrieval of the <interfacename>JpaDialect</interfacename> supports retrieval of the
underlying JDBC <interfacename>Connection</interfacename>. Out of the box, underlying JDBC <interfacename>Connection</interfacename>. Out of the
Spring provides dialects for the Toplink, Hibernate and OpenJPA JPA box, Spring provides dialects for the Toplink, Hibernate and OpenJPA JPA
implementations. See the next section for details on the implementations. See the next section for details on the
<interfacename>JpaDialect</interfacename> mechanism.</para> <interfacename>JpaDialect</interfacename> mechanism.</para>
</section>
<section id="orm-jpa-dialect">
<title><interfacename>JpaDialect</interfacename></title>
<para>As an advanced feature <classname>JpaTemplate</classname>,
<classname>JpaTransactionManager</classname> and subclasses of
<classname>AbstractEntityManagerFactoryBean</classname> support a custom
<interfacename>JpaDialect</interfacename>, to be passed into the
"jpaDialect" bean property. In such a scenario, the DAOs won't receive
an <interfacename>EntityManagerFactory</interfacename> reference but
rather a full <classname>JpaTemplate</classname> instance instead (for
example, passed into <classname>JpaDaoSupport</classname>'s
"jpaTemplate" property). A <interfacename>JpaDialect</interfacename>
implementation can enable some advanced features supported by Spring,
usually in a vendor-specific manner:</para>
<itemizedlist>
<listitem>
<para>applying specific transaction semantics (such as custom
isolation level or transaction timeout)</para>
</listitem>
<listitem>
<para>retrieving the transactional JDBC
<interfacename>Connection</interfacename> (for exposure to
JDBC-based DAOs)</para>
</listitem>
<listitem>
<para>advanced translation of
<literal>PersistenceExceptions</literal> to Spring
<literal>DataAccessExceptions</literal></para>
</listitem>
</itemizedlist>
<para>This is particularly valuable for special transaction semantics
and for advanced translation of exception. Note that the default
implementation used (<classname>DefaultJpaDialect</classname>) doesn't
provide any special capabilities and if the above features are required,
the appropriate dialect has to be specified.</para>
<para>See the <interfacename>JpaDialect</interfacename> Javadoc for more
details of its operations and how they are used within Spring's JPA
support.</para>
</section>
</section> </section>
<section id="orm-ibatis"> <section id="orm-ibatis">