1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. 4 5 This program and the accompanying materials are made available under the 6 terms of the Eclipse Public License v. 2.0 which is available at 7 http://www.eclipse.org/legal/epl-2.0, 8 or the Eclipse Distribution License v. 1.0 which is available at 9 http://www.eclipse.org/org/documents/edl-v10.php. 10 11 SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 12 13--> 14 15<!-- persistence.xml schema --> 16<xsd:schema targetNamespace="http://xmlns.jcp.org/xml/ns/persistence" 17 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 18 xmlns:persistence="http://xmlns.jcp.org/xml/ns/persistence" 19 elementFormDefault="qualified" 20 attributeFormDefault="unqualified" 21 version="2.1"> 22 23 <xsd:annotation> 24 <xsd:documentation> 25 @(#)persistence_2_1.xsd 2.1 February 4, 2013 26 </xsd:documentation> 27 </xsd:annotation> 28 29 <xsd:annotation> 30 <xsd:documentation> 31 32 Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved. 33 34 This program and the accompanying materials are made available under the 35 terms of the Eclipse Public License v. 2.0 which is available at 36 http://www.eclipse.org/legal/epl-2.0, 37 or the Eclipse Distribution License v. 1.0 which is available at 38 http://www.eclipse.org/org/documents/edl-v10.php. 39 40 SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause 41 42 Contributors: 43 Linda DeMichiel - Java Persistence 2.1, Version 2.1 (February 4, 2013) 44 Specification available from http://jcp.org/en/jsr/detail?id=338 45 46 </xsd:documentation> 47 </xsd:annotation> 48 49 <xsd:annotation> 50 <xsd:documentation><![CDATA[ 51 52 This is the XML Schema for the persistence configuration file. 53 The file must be named "META-INF/persistence.xml" in the 54 persistence archive. 55 56 Persistence configuration files must indicate 57 the persistence schema by using the persistence namespace: 58 59 http://xmlns.jcp.org/xml/ns/persistence 60 61 and indicate the version of the schema by 62 using the version element as shown below: 63 64 <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" 65 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 66 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence 67 http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" 68 version="2.1"> 69 ... 70 </persistence> 71 72 ]]></xsd:documentation> 73 </xsd:annotation> 74 75 <xsd:simpleType name="versionType"> 76 <xsd:restriction base="xsd:token"> 77 <xsd:pattern value="[0-9]+(\.[0-9]+)*"/> 78 </xsd:restriction> 79 </xsd:simpleType> 80 81 <!-- **************************************************** --> 82 83 <xsd:element name="persistence"> 84 <xsd:complexType> 85 <xsd:sequence> 86 87 <!-- **************************************************** --> 88 89 <xsd:element name="persistence-unit" 90 minOccurs="1" maxOccurs="unbounded"> 91 <xsd:complexType> 92 <xsd:annotation> 93 <xsd:documentation> 94 95 Configuration of a persistence unit. 96 97 </xsd:documentation> 98 </xsd:annotation> 99 <xsd:sequence> 100 101 <!-- **************************************************** --> 102 103 <xsd:element name="description" type="xsd:string" 104 minOccurs="0"> 105 <xsd:annotation> 106 <xsd:documentation> 107 108 Description of this persistence unit. 109 110 </xsd:documentation> 111 </xsd:annotation> 112 </xsd:element> 113 114 <!-- **************************************************** --> 115 116 <xsd:element name="provider" type="xsd:string" 117 minOccurs="0"> 118 <xsd:annotation> 119 <xsd:documentation> 120 121 Provider class that supplies EntityManagers for this 122 persistence unit. 123 124 </xsd:documentation> 125 </xsd:annotation> 126 </xsd:element> 127 128 <!-- **************************************************** --> 129 130 <xsd:element name="jta-data-source" type="xsd:string" 131 minOccurs="0"> 132 <xsd:annotation> 133 <xsd:documentation> 134 135 The container-specific name of the JTA datasource to use. 136 137 </xsd:documentation> 138 </xsd:annotation> 139 </xsd:element> 140 141 <!-- **************************************************** --> 142 143 <xsd:element name="non-jta-data-source" type="xsd:string" 144 minOccurs="0"> 145 <xsd:annotation> 146 <xsd:documentation> 147 148 The container-specific name of a non-JTA datasource to use. 149 150 </xsd:documentation> 151 </xsd:annotation> 152 </xsd:element> 153 154 <!-- **************************************************** --> 155 156 <xsd:element name="mapping-file" type="xsd:string" 157 minOccurs="0" maxOccurs="unbounded"> 158 <xsd:annotation> 159 <xsd:documentation> 160 161 File containing mapping information. Loaded as a resource 162 by the persistence provider. 163 164 </xsd:documentation> 165 </xsd:annotation> 166 </xsd:element> 167 168 <!-- **************************************************** --> 169 170 <xsd:element name="jar-file" type="xsd:string" 171 minOccurs="0" maxOccurs="unbounded"> 172 <xsd:annotation> 173 <xsd:documentation> 174 175 Jar file that is to be scanned for managed classes. 176 177 </xsd:documentation> 178 </xsd:annotation> 179 </xsd:element> 180 181 <!-- **************************************************** --> 182 183 <xsd:element name="class" type="xsd:string" 184 minOccurs="0" maxOccurs="unbounded"> 185 <xsd:annotation> 186 <xsd:documentation> 187 188 Managed class to be included in the persistence unit and 189 to scan for annotations. It should be annotated 190 with either @Entity, @Embeddable or @MappedSuperclass. 191 192 </xsd:documentation> 193 </xsd:annotation> 194 </xsd:element> 195 196 <!-- **************************************************** --> 197 198 <xsd:element name="exclude-unlisted-classes" type="xsd:boolean" 199 default="true" minOccurs="0"> 200 <xsd:annotation> 201 <xsd:documentation> 202 203 When set to true then only listed classes and jars will 204 be scanned for persistent classes, otherwise the 205 enclosing jar or directory will also be scanned. 206 Not applicable to Java SE persistence units. 207 208 </xsd:documentation> 209 </xsd:annotation> 210 </xsd:element> 211 212 <!-- **************************************************** --> 213 214 <xsd:element name="shared-cache-mode" 215 type="persistence:persistence-unit-caching-type" 216 minOccurs="0"> 217 <xsd:annotation> 218 <xsd:documentation> 219 220 Defines whether caching is enabled for the 221 persistence unit if caching is supported by the 222 persistence provider. When set to ALL, all entities 223 will be cached. When set to NONE, no entities will 224 be cached. When set to ENABLE_SELECTIVE, only entities 225 specified as cacheable will be cached. When set to 226 DISABLE_SELECTIVE, entities specified as not cacheable 227 will not be cached. When not specified or when set to 228 UNSPECIFIED, provider defaults may apply. 229 230 </xsd:documentation> 231 </xsd:annotation> 232 </xsd:element> 233 234 <!-- **************************************************** --> 235 236 <xsd:element name="validation-mode" 237 type="persistence:persistence-unit-validation-mode-type" 238 minOccurs="0"> 239 <xsd:annotation> 240 <xsd:documentation> 241 242 The validation mode to be used for the persistence unit. 243 244 </xsd:documentation> 245 </xsd:annotation> 246 </xsd:element> 247 248 249 <!-- **************************************************** --> 250 251 <xsd:element name="properties" minOccurs="0"> 252 <xsd:annotation> 253 <xsd:documentation> 254 255 A list of standard and vendor-specific properties 256 and hints. 257 258 </xsd:documentation> 259 </xsd:annotation> 260 <xsd:complexType> 261 <xsd:sequence> 262 <xsd:element name="property" 263 minOccurs="0" maxOccurs="unbounded"> 264 <xsd:annotation> 265 <xsd:documentation> 266 A name-value pair. 267 </xsd:documentation> 268 </xsd:annotation> 269 <xsd:complexType> 270 <xsd:attribute name="name" type="xsd:string" 271 use="required"/> 272 <xsd:attribute name="value" type="xsd:string" 273 use="required"/> 274 </xsd:complexType> 275 </xsd:element> 276 </xsd:sequence> 277 </xsd:complexType> 278 </xsd:element> 279 280 </xsd:sequence> 281 282 <!-- **************************************************** --> 283 284 <xsd:attribute name="name" type="xsd:string" use="required"> 285 <xsd:annotation> 286 <xsd:documentation> 287 288 Name used in code to reference this persistence unit. 289 290 </xsd:documentation> 291 </xsd:annotation> 292 </xsd:attribute> 293 294 <!-- **************************************************** --> 295 296 <xsd:attribute name="transaction-type" 297 type="persistence:persistence-unit-transaction-type"> 298 <xsd:annotation> 299 <xsd:documentation> 300 301 Type of transactions used by EntityManagers from this 302 persistence unit. 303 304 </xsd:documentation> 305 </xsd:annotation> 306 </xsd:attribute> 307 308 </xsd:complexType> 309 </xsd:element> 310 </xsd:sequence> 311 <xsd:attribute name="version" type="persistence:versionType" 312 fixed="2.1" use="required"/> 313 </xsd:complexType> 314 </xsd:element> 315 316 <!-- **************************************************** --> 317 318 <xsd:simpleType name="persistence-unit-transaction-type"> 319 <xsd:annotation> 320 <xsd:documentation> 321 322 public enum PersistenceUnitTransactionType {JTA, RESOURCE_LOCAL}; 323 324 </xsd:documentation> 325 </xsd:annotation> 326 <xsd:restriction base="xsd:token"> 327 <xsd:enumeration value="JTA"/> 328 <xsd:enumeration value="RESOURCE_LOCAL"/> 329 </xsd:restriction> 330 </xsd:simpleType> 331 332<!-- **************************************************** --> 333 334 <xsd:simpleType name="persistence-unit-caching-type"> 335 <xsd:annotation> 336 <xsd:documentation> 337 338 public enum SharedCacheMode { ALL, NONE, ENABLE_SELECTIVE, DISABLE_SELECTIVE, UNSPECIFIED}; 339 340 </xsd:documentation> 341 </xsd:annotation> 342 <xsd:restriction base="xsd:token"> 343 <xsd:enumeration value="ALL"/> 344 <xsd:enumeration value="NONE"/> 345 <xsd:enumeration value="ENABLE_SELECTIVE"/> 346 <xsd:enumeration value="DISABLE_SELECTIVE"/> 347 <xsd:enumeration value="UNSPECIFIED"/> 348 </xsd:restriction> 349 </xsd:simpleType> 350 351<!-- **************************************************** --> 352 353 <xsd:simpleType name="persistence-unit-validation-mode-type"> 354 <xsd:annotation> 355 <xsd:documentation> 356 357 public enum ValidationMode { AUTO, CALLBACK, NONE}; 358 359 </xsd:documentation> 360 </xsd:annotation> 361 <xsd:restriction base="xsd:token"> 362 <xsd:enumeration value="AUTO"/> 363 <xsd:enumeration value="CALLBACK"/> 364 <xsd:enumeration value="NONE"/> 365 </xsd:restriction> 366 </xsd:simpleType> 367 368</xsd:schema> 369