You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
96 lines
3.6 KiB
96 lines
3.6 KiB
2 years ago
|
[[data.access.appendix]]
|
||
7 years ago
|
= Appendix
|
||
|
|
||
7 years ago
|
|
||
|
|
||
6 years ago
|
|
||
2 years ago
|
[[data.access.xsd-schemas]]
|
||
7 years ago
|
== XML Schemas
|
||
|
|
||
7 years ago
|
This part of the appendix lists XML schemas for data access, including the following:
|
||
|
|
||
|
* <<xsd-schemas-tx>>
|
||
|
* <<xsd-schemas-jdbc>>
|
||
7 years ago
|
|
||
|
|
||
7 years ago
|
|
||
7 years ago
|
[[xsd-schemas-tx]]
|
||
7 years ago
|
=== The `tx` Schema
|
||
7 years ago
|
|
||
|
The `tx` tags deal with configuring all of those beans in Spring's comprehensive support
|
||
|
for transactions. These tags are covered in the chapter entitled
|
||
6 years ago
|
<<data-access.adoc#transaction, Transaction Management>>.
|
||
7 years ago
|
|
||
7 years ago
|
TIP: We strongly encourage you to look at the `'spring-tx.xsd'` file that ships with the
|
||
7 years ago
|
Spring distribution. This file contains the XML Schema for Spring's transaction
|
||
|
configuration and covers all of the various elements in the `tx` namespace, including
|
||
7 years ago
|
attribute defaults and similar information. This file is documented inline, and, thus,
|
||
|
the information is not repeated here in the interests of adhering to the DRY (Don't
|
||
|
Repeat Yourself) principle.
|
||
7 years ago
|
|
||
7 years ago
|
In the interest of completeness, to use the elements in the `tx` schema, you need to have
|
||
|
the following preamble at the top of your Spring XML configuration file. The text in the
|
||
7 years ago
|
following snippet references the correct schema so that the tags in the `tx` namespace
|
||
7 years ago
|
are available to you:
|
||
7 years ago
|
|
||
5 years ago
|
[source,xml,indent=0,subs="verbatim,quotes"]
|
||
7 years ago
|
----
|
||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||
7 years ago
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||
|
xmlns:tx="http://www.springframework.org/schema/tx" <1>
|
||
2 years ago
|
xmlns:aop="http://www.springframework.org/schema/aop"
|
||
7 years ago
|
xsi:schemaLocation="
|
||
2 years ago
|
http://www.springframework.org/schema/beans
|
||
|
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||
|
http://www.springframework.org/schema/tx
|
||
|
https://www.springframework.org/schema/tx/spring-tx.xsd <2>
|
||
|
http://www.springframework.org/schema/aop
|
||
|
https://www.springframework.org/schema/aop/spring-aop.xsd">
|
||
7 years ago
|
|
||
|
<!-- bean definitions here -->
|
||
7 years ago
|
|
||
|
</beans>
|
||
|
----
|
||
7 years ago
|
<1> Declare usage of the `tx` namespace.
|
||
7 years ago
|
<2> Specify the location (with other schema locations).
|
||
|
|
||
7 years ago
|
NOTE: Often, when you use the elements in the `tx` namespace, you are also using the
|
||
|
elements from the `aop` namespace (since the declarative transaction support in Spring is
|
||
|
implemented by using AOP). The preceding XML snippet contains the relevant lines needed
|
||
|
to reference the `aop` schema so that the elements in the `aop` namespace are available
|
||
|
to you.
|
||
7 years ago
|
|
||
|
|
||
|
|
||
|
[[xsd-schemas-jdbc]]
|
||
7 years ago
|
=== The `jdbc` Schema
|
||
7 years ago
|
|
||
7 years ago
|
The `jdbc` elements let you quickly configure an embedded database or initialize an
|
||
|
existing data source. These elements are documented in
|
||
6 years ago
|
<<data-access.adoc#jdbc-embedded-database-support, Embedded Database Support>> and
|
||
|
<<data-access.adoc#jdbc-initializing-datasource, Initializing a DataSource>>, respectively.
|
||
7 years ago
|
|
||
7 years ago
|
To use the elements in the `jdbc` schema, you need to have the following preamble at the
|
||
|
top of your Spring XML configuration file. The text in the following snippet references
|
||
|
the correct schema so that the elements in the `jdbc` namespace are available to you:
|
||
7 years ago
|
|
||
5 years ago
|
[source,xml,indent=0,subs="verbatim,quotes"]
|
||
7 years ago
|
----
|
||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||
7 years ago
|
xmlns:jdbc="http://www.springframework.org/schema/jdbc" <1>
|
||
|
xsi:schemaLocation="
|
||
2 years ago
|
http://www.springframework.org/schema/beans
|
||
|
https://www.springframework.org/schema/beans/spring-beans.xsd
|
||
|
http://www.springframework.org/schema/jdbc
|
||
|
https://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> <2>
|
||
7 years ago
|
|
||
|
<!-- bean definitions here -->
|
||
7 years ago
|
|
||
|
</beans>
|
||
|
----
|
||
7 years ago
|
<1> Declare usage of the `jdbc` namespace.
|
||
7 years ago
|
<2> Specify the location (with other schema locations).
|