diff --git a/spring-framework-reference/src/orm.xml b/spring-framework-reference/src/orm.xml index b74d75aa30d..a8525fa5723 100644 --- a/spring-framework-reference/src/orm.xml +++ b/spring-framework-reference/src/orm.xml @@ -1,7 +1,6 @@ - +"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"> Object Relational Mapping (ORM) data access @@ -9,17 +8,17 @@ Introduction The Spring Framework provides integration with Hibernate, - JDO, iBATIS SQL Maps and JPA: in terms - of resource management, DAO implementation support, and - transaction strategies. For example for Hibernate, there is - first-class support with lots of IoC convenience features, - addressing many typical Hibernate integration issues. All of - these support packages for O/R (Object Relational) mappers comply with - Spring's generic transaction and DAO exception hierarchies. There are - usually two integration styles: either using Spring's DAO 'templates' or - coding DAOs against plain Hibernate/JDO/JPA/etc APIs. In both cases, - DAOs can be configured through Dependency Injection and participate in - Spring's resource and transaction management. + JDO, iBATIS SQL Maps and JPA: in terms of + resource management, DAO implementation support, and transaction + strategies. For example for Hibernate, there is first-class support with + lots of IoC convenience features, addressing many typical Hibernate + integration issues. All of these support packages for O/R (Object + Relational) mappers comply with Spring's generic transaction and DAO + exception hierarchies. There are usually two integration styles: either + using Spring's DAO 'templates' or coding DAOs against plain + Hibernate/JDO/JPA/etc APIs. In both cases, DAOs can be configured through + Dependency Injection and participate in Spring's resource and transaction + management. Spring adds significant support when using the O/R mapping layer of your choice to create data access applications. First of all, you should @@ -102,10 +101,10 @@ The PetClinic sample in the Spring distribution offers alternative DAO implementations and application context configurations for JDBC, - Hibernate, and JPA. PetClinic can therefore serve as - working sample app that illustrates the use of Hibernate and JPA - in a Spring web application. It also leverages declarative transaction - demarcation with different transaction strategies. + Hibernate, and JPA. PetClinic can therefore serve as working sample app + that illustrates the use of Hibernate and JPA in a Spring web application. + It also leverages declarative transaction demarcation with different + transaction strategies. The JPetStore sample illustrates the use of iBATIS SQL Maps in a Spring environment. It also features two web tier versions: one based on @@ -1297,8 +1296,8 @@ exposing a JDO transaction to JDBC access code that accesses the same JDBC DataSource, provided that the registered JdoDialect supports retrieval of the - underlying JDBC Connection. This is - the case for JDBC-based JDO 2.0 implementations by default. + underlying JDBC Connection. This is the + case for JDBC-based JDO 2.0 implementations by default.
@@ -1345,7 +1344,8 @@ See the JdoDialect Javadoc for more details - on its operations and how they are used within Spring's JDO support. + on its operations and how they are used within Spring's JDO + support.
@@ -1675,27 +1675,29 @@ </beans> - A typical persistence.xml file looks as follows: + A typical persistence.xml file looks as + follows: <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> - <persistence-unit name="myUnit" transaction-type="RESOURCE_LOCAL"> - <mapping-file>META-INF/orm.xml</mapping-file> + <persistence-unit name="myUnit" transaction-type="RESOURCE_LOCAL"> + <mapping-file>META-INF/orm.xml</mapping-file> <exclude-unlisted-classes/> </persistence-unit> -</persistence> +</persistence> NOTE: The "exclude-unlisted-classes" element always - indicates that NO scanning for annotated entity classes is supposed - to happen, in order to support the - <exclude-unlisted-classes/> shortcut. - This is in line with the JPA specification (which suggests that shortcut) - but unfortunately in conflict with the JPA XSD (which implies "false" - for that shortcut). As a consequence, - "<exclude-unlisted-classes> false </exclude-unlisted-classes/>" - is not supported! Simply omit the "exclude-unlisted-classes" element if - you would like entity class scanning to actually happen. + indicates that NO scanning for annotated entity classes is supposed to + happen, in order to support the + <exclude-unlisted-classes/> shortcut. This is + in line with the JPA specification (which suggests that shortcut) but + unfortunately in conflict with the JPA XSD (which implies "false" for + that shortcut). As a consequence, + "<exclude-unlisted-classes> false + </exclude-unlisted-classes/>" is not supported! Simply + omit the "exclude-unlisted-classes" element if you would like entity + class scanning to actually happen. This is the most powerful JPA setup option, allowing for flexible local configuration within the application. It supports links @@ -1751,22 +1753,22 @@ LoadTimeWeaver implementations for various environments, allowing ClassTransformer instances to be - applied only per ClassLoader and not per VM. + applied only per ClassLoader and not per + VM. The following sections will discuss typical JPA weaving setup on Tomcat as well as using Spring's VM agent. See the AOP chapter section - entitled for details on how to set - up general load-time weaving, covering Tomcat and the VM agent as well - as WebLogic, OC4J, GlassFish and Resin. + entitled for details on how to + set up general load-time weaving, covering Tomcat and the VM agent as + well as WebLogic, OC4J, GlassFish and Resin.
Tomcat load-time weaving setup (5.0+) - Apache - Tomcat's default ClassLoader does not support class - transformation but allows custom ClassLoaders to be used. Spring - offers the TomcatInstrumentableClassLoader - (inside the + Apache Tomcat's + default ClassLoader does not support class transformation but allows + custom ClassLoaders to be used. Spring offers the + TomcatInstrumentableClassLoader (inside the org.springframework.instrument.classloading.tomcat package) which extends the Tomcat ClassLoader (WebappClassLoader) and allows JPA @@ -1826,7 +1828,8 @@ If you are using Tomcat 5.5.20+ you can set useSystemClassLoaderAsParent to - false to fix the problem: <Context path="/myWebApp" docBase="/my/webApp/location"> + false to fix the problem: <Context path="/myWebApp" docBase="/my/webApp/location"> <Loader loaderClass="org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader" useSystemClassLoaderAsParent="false"/> </Context> @@ -1892,8 +1895,8 @@ other. - If TopLink Essentials is being used a JPA provider under Tomcat, please - place the toplink-essentials jar under + If TopLink Essentials is being used a JPA provider under + Tomcat, please place the toplink-essentials jar under $CATALINA_HOME/shared/lib folder instead of your war. @@ -1924,14 +1927,17 @@
Context-wide load-time weaver setup - Since Spring 2.5, a context-wide LoadTimeWeaver - can be configured using the context:load-time-weaver configuration + Since Spring 2.5, a context-wide + LoadTimeWeaver can be configured + using the context:load-time-weaver configuration element. Such a 'global' weaver will be picked up by all JPA - LocalContainerEntityManagerFactoryBeans automatically. + LocalContainerEntityManagerFactoryBeans + automatically. - This is the preferred way of setting up a load-time weaver, delivering - autodetection of the platform (WebLogic, OC4J, GlassFish, Tomcat, Resin, VM agent) - as well as automatic propagation of the weaver to all weaver-aware beans. + This is the preferred way of setting up a load-time weaver, + delivering autodetection of the platform (WebLogic, OC4J, GlassFish, + Tomcat, Resin, VM agent) as well as automatic propagation of the + weaver to all weaver-aware beans. <context:load-time-weaver/> @@ -1939,11 +1945,11 @@ ... </bean> - See the section entitled - for details on how to set up general load-time weaving, covering Tomcat - and the VM agent as well as WebLogic, OC4J, GlassFish and Resin. + See the section entitled + for details on how to set up general load-time weaving, covering + Tomcat and the VM agent as well as WebLogic, OC4J, GlassFish and + Resin.
-
@@ -1984,12 +1990,12 @@ Note that the default implementation allows customization of the persistence unit infos before feeding them to the JPA provider - declaratively through its properties (which affect all - hosted units) or programmatically, through the - PersistenceUnitPostProcessor - (which allows persistence unit selection). If no - PersistenceUnitManager is - specified, one will be created and used internally by + declaratively through its properties (which affect + all hosted units) or programmatically, through + the PersistenceUnitPostProcessor (which + allows persistence unit selection). If no + PersistenceUnitManager is specified, + one will be created and used internally by LocalContainerEntityManagerFactoryBean.
@@ -2212,8 +2218,8 @@ What about class level annotations? - On the Java EE 5 platform, they are used for dependency declaration - and not for resource injection. + On the Java EE 5 platform, they are used for dependency + declaration and not for resource injection. The injected EntityManager is @@ -2376,4 +2382,4 @@ public class ProductDaoImpl implements ProductDao { details of its operations and how they are used within Spring's JPA support. -
\ No newline at end of file +