<?xml version="1.0" encoding="UTF-8"?>
<!--
 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.   
-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="2.0">
    
    <persistence-unit name="simple">
    	<class>org.apache.openjpa.integration.validation.SimpleEntity</class>
    </persistence-unit>

    <persistence-unit name="simple-auto-mode">
    	<class>org.apache.openjpa.integration.validation.SimpleEntity</class>
        <validation-mode>AUTO</validation-mode>
    </persistence-unit>

    <persistence-unit name="simple-callback-mode">
    	<class>org.apache.openjpa.integration.validation.SimpleEntity</class>
        <validation-mode>CALLBACK</validation-mode>
    </persistence-unit>

    <persistence-unit name="simple-none-mode">
    	<class>org.apache.openjpa.integration.validation.SimpleEntity</class>
        <validation-mode>NONE</validation-mode>
    </persistence-unit>
    
    <persistence-unit name="boolean-none-mode">
        <class>org.apache.openjpa.integration.validation.ConstraintBoolean</class>
        <validation-mode>NONE</validation-mode>
    </persistence-unit>

    <persistence-unit name="boolean-callback-mode">
        <class>org.apache.openjpa.integration.validation.ConstraintBoolean</class>
        <validation-mode>CALLBACK</validation-mode>
    </persistence-unit>
    
    <persistence-unit name="decimal-none-mode">
        <class>org.apache.openjpa.integration.validation.ConstraintDecimal</class>
        <validation-mode>NONE</validation-mode>
    </persistence-unit>

    <persistence-unit name="decimal-callback-mode">
        <class>org.apache.openjpa.integration.validation.ConstraintDecimal</class>
        <validation-mode>CALLBACK</validation-mode>
    </persistence-unit>
    
    <persistence-unit name="null-none-mode">
    	<class>org.apache.openjpa.integration.validation.ConstraintNull</class>
        <validation-mode>NONE</validation-mode>
    </persistence-unit>

    <persistence-unit name="null-callback-mode">
    	<class>org.apache.openjpa.integration.validation.ConstraintNull</class>
        <validation-mode>CALLBACK</validation-mode>
    </persistence-unit>

    <persistence-unit name="address-none-mode">
        <class>org.apache.openjpa.integration.validation.Address</class>
        <validation-mode>NONE</validation-mode>
    </persistence-unit>

    <persistence-unit name="person-none-mode">
        <class>org.apache.openjpa.integration.validation.Person</class>
        <validation-mode>NONE</validation-mode>
    </persistence-unit>

    <persistence-unit name="default-validation-group">
        <class>org.apache.openjpa.integration.validation.DefGrpEntity</class>
        <validation-mode>CALLBACK</validation-mode>
        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings" 
                value="buildSchema"/>
        </properties>        
    </persistence-unit>
    
    <persistence-unit name="pre-remove-default-validation-group">
        <class>org.apache.openjpa.integration.validation.DefGrpEntity</class>
        <validation-mode>CALLBACK</validation-mode>
        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings" 
                value="buildSchema"/>
            <property name="javax.persistence.validation.group.pre-remove"
                value="javax.validation.groups.Default"/>
        </properties>        
    </persistence-unit>

    <persistence-unit name="non-default-validation-group">
        <class>org.apache.openjpa.integration.validation.NonDefGrpEntity</class>
        <validation-mode>CALLBACK</validation-mode>
        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings" 
                value="buildSchema"/>
            <property name="javax.persistence.validation.group.pre-persist"
                value="org.apache.openjpa.integration.validation.ValGroup1"/>
            <property name="javax.persistence.validation.group.pre-update"
                value="org.apache.openjpa.integration.validation.ValGroup1"/>
            <property name="javax.persistence.validation.group.pre-remove"
                value="org.apache.openjpa.integration.validation.ValGroup1"/>
        </properties>
    </persistence-unit>

    <persistence-unit name="multi-validation-group">
        <class>org.apache.openjpa.integration.validation.MixedGrpEntity</class>
        <validation-mode>CALLBACK</validation-mode>
        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings" 
                value="buildSchema"/>
            <!-- Properties passed in via createEMF -->
        </properties>
    </persistence-unit>

    <persistence-unit name="ConstraintPU">
        <class>org.apache.openjpa.integration.validation.ConstraintNull</class>
        <class>org.apache.openjpa.integration.validation.ConstraintBoolean</class>
        <class>org.apache.openjpa.integration.validation.ConstraintDecimal</class>
        <class>org.apache.openjpa.integration.validation.ConstraintNumber</class>
        <class>org.apache.openjpa.integration.validation.ConstraintDigits</class>
        <class>org.apache.openjpa.integration.validation.ConstraintSize</class>
        <class>org.apache.openjpa.integration.validation.ConstraintDates</class>
        <class>org.apache.openjpa.integration.validation.ConstraintPattern</class>
        <class>org.apache.openjpa.integration.validation.Person</class>
        <class>org.apache.openjpa.integration.validation.Address</class> 
        <class>org.apache.openjpa.integration.validation.Book</class>       
        <validation-mode>AUTO</validation-mode>
        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings" 
                value="buildSchema"/>
        </properties>
    </persistence-unit>
    
    <persistence-unit name="validation-pu">
        <class>org.apache.openjpa.integration.validation.Book</class> 
        <class>org.apache.openjpa.integration.validation.Publisher</class>      
        <validation-mode>AUTO</validation-mode>
    </persistence-unit>
    
    <persistence-unit name="non-validation-pu">
        <class>org.apache.openjpa.integration.validation.Book</class> 
        <class>org.apache.openjpa.integration.validation.Publisher</class>         
        <validation-mode>NONE</validation-mode>
    </persistence-unit>
    
    
    <persistence-unit name="XMLConstraintPU">
        <description>Make sure the mapping file and class listings match the same PU
         in META-INF/ehn-persistence.xml</description>
        <mapping-file>org/apache/openjpa/integration/validation/validation-orm.xml</mapping-file>
        <class>org.apache.openjpa.integration.validation.XMLBase</class>
        <class>org.apache.openjpa.integration.validation.XMLSuper</class>
        <validation-mode>AUTO</validation-mode>
        <properties>
            <property name="openjpa.jdbc.SynchronizeMappings" 
                value="buildSchema"/>
        </properties>
    </persistence-unit>
    
</persistence>
