org.apache.openejb.jee.jpa.unit.Persistence Maven / Gradle / Ivy
The newest version!
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.openejb.jee.jpa.unit;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.ArrayList;
import java.util.List;
/**
* Java class for anonymous complex type.
*
* The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="persistence-unit" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="provider" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="non-jta-data-source" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="mapping-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
* <element name="jar-file" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
* <element name="class" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
* <element name="exclude-unlisted-classes" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
* <element name="properties" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="property" maxOccurs="unbounded" minOccurs="0">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="value" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="transaction-type" type="{http://java.sun.com/xml/ns/persistence}persistence-unit-transaction-type" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="version" use="required" type="{http://java.sun.com/xml/ns/persistence}versionType" fixed="1.0" />
* </restriction>
* </complexContent>
* </complexType>
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"persistenceUnit"
})
@XmlRootElement(name = "persistence")
public class Persistence {
@XmlElement(name = "persistence-unit", required = true)
protected List persistenceUnit;
@XmlAttribute(required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String version = "1.0";
public Persistence() {
}
public Persistence(final PersistenceUnit... persistenceUnit) {
for (final PersistenceUnit unit : persistenceUnit) {
getPersistenceUnit().add(unit);
}
}
/**
* Gets the value of the persistenceUnit property.
*
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the persistenceUnit property.
*
*
* For example, to add a new item, do as follows:
*
* getPersistenceUnit().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link PersistenceUnit }
*/
public List getPersistenceUnit() {
if (persistenceUnit == null) {
persistenceUnit = new ArrayList();
}
return this.persistenceUnit;
}
public PersistenceUnit addPersistenceUnit(final PersistenceUnit unit) {
getPersistenceUnit().add(unit);
return unit;
}
public PersistenceUnit addPersistenceUnit(final String unitName) {
return addPersistenceUnit(new PersistenceUnit(unitName));
}
/**
* Gets the value of the version property.
*
* @return possible object is
* {@link String }
*/
public String getVersion() {
if (version == null) {
return "1.0";
} else {
return version;
}
}
/**
* Sets the value of the version property.
*
* @param value allowed object is
* {@link String }
*/
public void setVersion(final String value) {
this.version = value;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy