persistence_2_0.xsd 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- persistence.xml schema -->
  3. <xsd:schema targetNamespace="http://java.sun.com/xml/ns/persistence"
  4. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  5. xmlns:persistence="http://java.sun.com/xml/ns/persistence"
  6. elementFormDefault="qualified"
  7. attributeFormDefault="unqualified"
  8. version="2.0">
  9. <xsd:annotation>
  10. <xsd:documentation>
  11. @(#)persistence_2_0.xsd 1.0 October 1 2009
  12. </xsd:documentation>
  13. </xsd:annotation>
  14. <xsd:annotation>
  15. <xsd:documentation><![CDATA[
  16. This is the XML Schema for the persistence configuration file.
  17. The file must be named "META-INF/persistence.xml" in the
  18. persistence archive.
  19. Persistence configuration files must indicate
  20. the persistence schema by using the persistence namespace:
  21. http://java.sun.com/xml/ns/persistence
  22. and indicate the version of the schema by
  23. using the version element as shown below:
  24. <persistence xmlns="http://java.sun.com/xml/ns/persistence"
  25. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  26. xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  27. http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
  28. version="2.0">
  29. ...
  30. </persistence>
  31. ]]></xsd:documentation>
  32. </xsd:annotation>
  33. <xsd:simpleType name="versionType">
  34. <xsd:restriction base="xsd:token">
  35. <xsd:pattern value="[0-9]+(\.[0-9]+)*"/>
  36. </xsd:restriction>
  37. </xsd:simpleType>
  38. <!-- **************************************************** -->
  39. <xsd:element name="persistence">
  40. <xsd:complexType>
  41. <xsd:sequence>
  42. <!-- **************************************************** -->
  43. <xsd:element name="persistence-unit"
  44. minOccurs="1" maxOccurs="unbounded">
  45. <xsd:complexType>
  46. <xsd:annotation>
  47. <xsd:documentation>
  48. Configuration of a persistence unit.
  49. </xsd:documentation>
  50. </xsd:annotation>
  51. <xsd:sequence>
  52. <!-- **************************************************** -->
  53. <xsd:element name="description" type="xsd:string"
  54. minOccurs="0">
  55. <xsd:annotation>
  56. <xsd:documentation>
  57. Description of this persistence unit.
  58. </xsd:documentation>
  59. </xsd:annotation>
  60. </xsd:element>
  61. <!-- **************************************************** -->
  62. <xsd:element name="provider" type="xsd:string"
  63. minOccurs="0">
  64. <xsd:annotation>
  65. <xsd:documentation>
  66. Provider class that supplies EntityManagers for this
  67. persistence unit.
  68. </xsd:documentation>
  69. </xsd:annotation>
  70. </xsd:element>
  71. <!-- **************************************************** -->
  72. <xsd:element name="jta-data-source" type="xsd:string"
  73. minOccurs="0">
  74. <xsd:annotation>
  75. <xsd:documentation>
  76. The container-specific name of the JTA datasource to use.
  77. </xsd:documentation>
  78. </xsd:annotation>
  79. </xsd:element>
  80. <!-- **************************************************** -->
  81. <xsd:element name="non-jta-data-source" type="xsd:string"
  82. minOccurs="0">
  83. <xsd:annotation>
  84. <xsd:documentation>
  85. The container-specific name of a non-JTA datasource to use.
  86. </xsd:documentation>
  87. </xsd:annotation>
  88. </xsd:element>
  89. <!-- **************************************************** -->
  90. <xsd:element name="mapping-file" type="xsd:string"
  91. minOccurs="0" maxOccurs="unbounded">
  92. <xsd:annotation>
  93. <xsd:documentation>
  94. File containing mapping information. Loaded as a resource
  95. by the persistence provider.
  96. </xsd:documentation>
  97. </xsd:annotation>
  98. </xsd:element>
  99. <!-- **************************************************** -->
  100. <xsd:element name="jar-file" type="xsd:string"
  101. minOccurs="0" maxOccurs="unbounded">
  102. <xsd:annotation>
  103. <xsd:documentation>
  104. Jar file that is to be scanned for managed classes.
  105. </xsd:documentation>
  106. </xsd:annotation>
  107. </xsd:element>
  108. <!-- **************************************************** -->
  109. <xsd:element name="class" type="xsd:string"
  110. minOccurs="0" maxOccurs="unbounded">
  111. <xsd:annotation>
  112. <xsd:documentation>
  113. Managed class to be included in the persistence unit and
  114. to scan for annotations. It should be annotated
  115. with either @Entity, @Embeddable or @MappedSuperclass.
  116. </xsd:documentation>
  117. </xsd:annotation>
  118. </xsd:element>
  119. <!-- **************************************************** -->
  120. <xsd:element name="exclude-unlisted-classes" type="xsd:boolean"
  121. default="true" minOccurs="0">
  122. <xsd:annotation>
  123. <xsd:documentation>
  124. When set to true then only listed classes and jars will
  125. be scanned for persistent classes, otherwise the
  126. enclosing jar or directory will also be scanned.
  127. Not applicable to Java SE persistence units.
  128. </xsd:documentation>
  129. </xsd:annotation>
  130. </xsd:element>
  131. <!-- **************************************************** -->
  132. <xsd:element name="shared-cache-mode"
  133. type="persistence:persistence-unit-caching-type"
  134. minOccurs="0">
  135. <xsd:annotation>
  136. <xsd:documentation>
  137. Defines whether caching is enabled for the
  138. persistence unit if caching is supported by the
  139. persistence provider. When set to ALL, all entities
  140. will be cached. When set to NONE, no entities will
  141. be cached. When set to ENABLE_SELECTIVE, only entities
  142. specified as cacheable will be cached. When set to
  143. DISABLE_SELECTIVE, entities specified as not cacheable
  144. will not be cached. When not specified or when set to
  145. UNSPECIFIED, provider defaults may apply.
  146. </xsd:documentation>
  147. </xsd:annotation>
  148. </xsd:element>
  149. <!-- **************************************************** -->
  150. <xsd:element name="validation-mode"
  151. type="persistence:persistence-unit-validation-mode-type"
  152. minOccurs="0">
  153. <xsd:annotation>
  154. <xsd:documentation>
  155. The validation mode to be used for the persistence unit.
  156. </xsd:documentation>
  157. </xsd:annotation>
  158. </xsd:element>
  159. <!-- **************************************************** -->
  160. <xsd:element name="properties" minOccurs="0">
  161. <xsd:annotation>
  162. <xsd:documentation>
  163. A list of standard and vendor-specific properties
  164. and hints.
  165. </xsd:documentation>
  166. </xsd:annotation>
  167. <xsd:complexType>
  168. <xsd:sequence>
  169. <xsd:element name="property"
  170. minOccurs="0" maxOccurs="unbounded">
  171. <xsd:annotation>
  172. <xsd:documentation>
  173. A name-value pair.
  174. </xsd:documentation>
  175. </xsd:annotation>
  176. <xsd:complexType>
  177. <xsd:attribute name="name" type="xsd:string"
  178. use="required"/>
  179. <xsd:attribute name="value" type="xsd:string"
  180. use="required"/>
  181. </xsd:complexType>
  182. </xsd:element>
  183. </xsd:sequence>
  184. </xsd:complexType>
  185. </xsd:element>
  186. </xsd:sequence>
  187. <!-- **************************************************** -->
  188. <xsd:attribute name="name" type="xsd:string" use="required">
  189. <xsd:annotation>
  190. <xsd:documentation>
  191. Name used in code to reference this persistence unit.
  192. </xsd:documentation>
  193. </xsd:annotation>
  194. </xsd:attribute>
  195. <!-- **************************************************** -->
  196. <xsd:attribute name="transaction-type"
  197. type="persistence:persistence-unit-transaction-type">
  198. <xsd:annotation>
  199. <xsd:documentation>
  200. Type of transactions used by EntityManagers from this
  201. persistence unit.
  202. </xsd:documentation>
  203. </xsd:annotation>
  204. </xsd:attribute>
  205. </xsd:complexType>
  206. </xsd:element>
  207. </xsd:sequence>
  208. <xsd:attribute name="version" type="persistence:versionType"
  209. fixed="2.0" use="required"/>
  210. </xsd:complexType>
  211. </xsd:element>
  212. <!-- **************************************************** -->
  213. <xsd:simpleType name="persistence-unit-transaction-type">
  214. <xsd:annotation>
  215. <xsd:documentation>
  216. public enum PersistenceUnitTransactionType {JTA, RESOURCE_LOCAL};
  217. </xsd:documentation>
  218. </xsd:annotation>
  219. <xsd:restriction base="xsd:token">
  220. <xsd:enumeration value="JTA"/>
  221. <xsd:enumeration value="RESOURCE_LOCAL"/>
  222. </xsd:restriction>
  223. </xsd:simpleType>
  224. <!-- **************************************************** -->
  225. <xsd:simpleType name="persistence-unit-caching-type">
  226. <xsd:annotation>
  227. <xsd:documentation>
  228. public enum SharedCacheMode { ALL, NONE, ENABLE_SELECTIVE,
  229. DISABLE_SELECTIVE, UNSPECIFIED};
  230. </xsd:documentation>
  231. </xsd:annotation>
  232. <xsd:restriction base="xsd:token">
  233. <xsd:enumeration value="ALL"/>
  234. <xsd:enumeration value="NONE"/>
  235. <xsd:enumeration value="ENABLE_SELECTIVE"/>
  236. <xsd:enumeration value="DISABLE_SELECTIVE"/>
  237. <xsd:enumeration value="UNSPECIFIED"/>
  238. </xsd:restriction>
  239. </xsd:simpleType>
  240. <!-- **************************************************** -->
  241. <xsd:simpleType name="persistence-unit-validation-mode-type">
  242. <xsd:annotation>
  243. <xsd:documentation>
  244. public enum ValidationMode { AUTO, CALLBACK, NONE};
  245. </xsd:documentation>
  246. </xsd:annotation>
  247. <xsd:restriction base="xsd:token">
  248. <xsd:enumeration value="AUTO"/>
  249. <xsd:enumeration value="CALLBACK"/>
  250. <xsd:enumeration value="NONE"/>
  251. </xsd:restriction>
  252. </xsd:simpleType>
  253. </xsd:schema>