Hibernate SVN: r15457 - in core/trunk/annotations: doc/reference and 6 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-10-31 06:57:35 -0400 (Fri, 31 Oct 2008)
New Revision: 15457
Added:
core/trunk/annotations/src/main/docbook/
core/trunk/annotations/src/main/docbook/en/
core/trunk/annotations/src/main/docbook/fr/
core/trunk/annotations/src/main/docbook/zh_cn/
Removed:
core/trunk/annotations/doc/reference/en/
core/trunk/annotations/doc/reference/fr/
core/trunk/annotations/doc/reference/zh_cn/
core/trunk/annotations/src/main/docbook/en/styles/
core/trunk/annotations/src/main/docbook/fr/styles/
core/trunk/annotations/src/main/docbook/zh_cn/styles/
Modified:
core/trunk/annotations/pom.xml
core/trunk/annotations/src/main/docbook/en/master.xml
core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml
core/trunk/annotations/src/main/docbook/en/modules/entity.xml
core/trunk/annotations/src/main/docbook/en/modules/setup.xml
core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml
Log:
make the documentation buildable via maven as well. In the long run we will have to combine all the documentation though
Modified: core/trunk/annotations/pom.xml
===================================================================
--- core/trunk/annotations/pom.xml 2008-10-31 10:26:47 UTC (rev 15456)
+++ core/trunk/annotations/pom.xml 2008-10-31 10:57:35 UTC (rev 15457)
@@ -134,6 +134,70 @@
<profiles>
+ <profile>
+ <id>doc</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugins</groupId>
+ <artifactId>maven-jdocbook-plugin</artifactId>
+ <version>2.1.0</version>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-jdocbook-style</artifactId>
+ <version>1.0.2</version>
+ <type>jdocbook-style</type>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <sourceDocumentName>master.xml</sourceDocumentName>
+ <sourceDirectory>${basedir}/src/main/docbook/en</sourceDirectory>
+ <masterTranslation>en-US</masterTranslation>
+ <imageResource>
+ <directory>${basedir}/src/main/docbook/en/images</directory>
+ </imageResource>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheetResource>classpath:/xslt/hibernate/pdf/main-pdf.xsl</stylesheetResource>
+ <finalName>hibernate-validator-legacy-guide.pdf</finalName>
+ </format>
+ <format>
+ <formatName>html_single</formatName>
+ <stylesheetResource>classpath:/xslt/hibernate/html/main-single.xsl
+ </stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheetResource>classpath:/xslt/hibernate/html/main-chunk.xsl
+ </stylesheetResource>
+ <finalName>index.html</finalName>
+ </format>
+ </formats>
+ <options>
+ <xincludeSupported>true</xincludeSupported>
+ <localeSeparator>-</localeSeparator>
+ <useRelativeImageUris>true</useRelativeImageUris>
+ </options>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-doc</id>
+ <phase>package</phase>
+ <goals>
+ <goal>resources</goal>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
<!-- HSQLDB is the default (eventually move to H2) -->
<profile>
<id>hsqldb</id>
Copied: core/trunk/annotations/src/main/docbook/en (from rev 15436, core/trunk/annotations/doc/reference/en)
Property changes on: core/trunk/annotations/src/main/docbook/en
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: core/trunk/annotations/src/main/docbook/en/master.xml
===================================================================
--- core/trunk/annotations/doc/reference/en/master.xml 2008-10-29 16:34:25 UTC (rev 15436)
+++ core/trunk/annotations/src/main/docbook/en/master.xml 2008-10-31 10:57:35 UTC (rev 15457)
@@ -1,10 +1,31 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN"
-"../support/docbook-dtd/docbookx.dtd" [
-<!ENTITY setup SYSTEM "modules/setup.xml">
-<!ENTITY entity SYSTEM "modules/entity.xml">
-<!ENTITY xml-overriding SYSTEM "modules/xml-overriding.xml">
-<!ENTITY additionalmodules SYSTEM "modules/additionalmodules.xml">
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+ <!ENTITY versionNumber "3.4.0.GA">
+ <!ENTITY copyrightYear "2004">
+ <!ENTITY copyrightHolder "Red Hat Middleware, LLC.">
]>
<book lang="en">
<bookinfo>
@@ -12,7 +33,7 @@
<subtitle>Reference Guide</subtitle>
- <releaseinfo>3.4.0.GA</releaseinfo>
+ <releaseinfo>&versionNumber;</releaseinfo>
<mediaobject>
<imageobject>
@@ -21,7 +42,7 @@
</mediaobject>
</bookinfo>
- <toc></toc>
+ <toc/>
<preface id="preface" revision="1">
<title>Preface</title>
@@ -67,11 +88,9 @@
Persistence migration guide</ulink>.</para>
</preface>
- &setup;
-
- &entity;
-
- &xml-overriding;
-
- &additionalmodules;
+ <xi:include href="modules/setup.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="modules/entity.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="modules/xml-overriding.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="modules/additionalmodules.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
</book>
\ No newline at end of file
Modified: core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml
===================================================================
--- core/trunk/annotations/doc/reference/en/modules/additionalmodules.xml 2008-10-29 16:34:25 UTC (rev 15436)
+++ core/trunk/annotations/src/main/docbook/en/modules/additionalmodules.xml 2008-10-31 10:57:35 UTC (rev 15457)
@@ -1,4 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="additionalmodules">
<title>Additional modules</title>
Modified: core/trunk/annotations/src/main/docbook/en/modules/entity.xml
===================================================================
--- core/trunk/annotations/doc/reference/en/modules/entity.xml 2008-10-29 16:34:25 UTC (rev 15436)
+++ core/trunk/annotations/src/main/docbook/en/modules/entity.xml 2008-10-31 10:57:35 UTC (rev 15457)
@@ -1,4 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="entity">
<title>Entity Beans</title>
Modified: core/trunk/annotations/src/main/docbook/en/modules/setup.xml
===================================================================
--- core/trunk/annotations/doc/reference/en/modules/setup.xml 2008-10-29 16:34:25 UTC (rev 15436)
+++ core/trunk/annotations/src/main/docbook/en/modules/setup.xml 2008-10-31 10:57:35 UTC (rev 15457)
@@ -1,4 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter>
<title id="setup" revision="1">Setting up an annotations project</title>
Modified: core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml
===================================================================
--- core/trunk/annotations/doc/reference/en/modules/xml-overriding.xml 2008-10-29 16:34:25 UTC (rev 15436)
+++ core/trunk/annotations/src/main/docbook/en/modules/xml-overriding.xml 2008-10-31 10:57:35 UTC (rev 15457)
@@ -1,4 +1,29 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="xml-overriding" label="Overriding metadata through XML">
<title>Overriding metadata through XML</title>
Copied: core/trunk/annotations/src/main/docbook/fr (from rev 15436, core/trunk/annotations/doc/reference/fr)
Property changes on: core/trunk/annotations/src/main/docbook/fr
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: core/trunk/annotations/src/main/docbook/zh_cn (from rev 15436, core/trunk/annotations/doc/reference/zh_cn)
Property changes on: core/trunk/annotations/src/main/docbook/zh_cn
___________________________________________________________________
Name: svn:mergeinfo
+
16 years, 2 months
Hibernate SVN: r15456 - in core/trunk/annotations/src/test: java/org/hibernate/test/annotations/onetomany and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-10-31 06:26:47 -0400 (Fri, 31 Oct 2008)
New Revision: 15456
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/onetomany/OneToManyTest.java
core/trunk/annotations/src/test/resources/hibernate.properties
Log:
commented out some tests until HHH-3577 gets fixed
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/manytomany/ManyToManyTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/manytomany/ManyToManyTest.java 2008-10-30 19:08:58 UTC (rev 15455)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/manytomany/ManyToManyTest.java 2008-10-31 10:26:47 UTC (rev 15456)
@@ -265,7 +265,8 @@
*
* @throws Exception in case the test fails.
*
- * This fails test fails for other databases (except HSQL) due to missing alias in order by clause:
+ * This test only works against databases which allow a mixed usage of
+ * table names and table aliases. The generated SQL for this test is:
*
* select
* contractor0_.EMPLOYER_ID as EMPLOYER1_1_,
@@ -285,54 +286,54 @@
*
*
*/
- @RequiresDialect(HSQLDialect.class)
- public void testOrderByContractor() throws Exception {
-
- Session s;
- Transaction tx;
- s = openSession();
- tx = s.beginTransaction();
-
- // create some test entities
- Employer employer = new Employer();
- Contractor contractor1 = new Contractor();
- contractor1.setName( "Emmanuel" );
- contractor1.setHourlyRate(100.0f);
- Contractor contractor2 = new Contractor();
- contractor2.setName( "Hardy" );
- contractor2.setHourlyRate(99.99f);
- s.persist( contractor1 );
- s.persist( contractor2 );
-
- // add contractors to employer
- List setOfContractors = new ArrayList();
- setOfContractors.add( contractor1 );
- setOfContractors.add( contractor2 );
- employer.setContractors( setOfContractors );
-
- // add employer to contractors
- Collection employerListContractor1 = new ArrayList();
- employerListContractor1.add( employer );
- contractor1.setEmployers( employerListContractor1 );
-
- Collection employerListContractor2 = new ArrayList();
- employerListContractor2.add( employer );
- contractor2.setEmployers( employerListContractor2 );
+// HHH-3577
+// public void testOrderByContractor() throws Exception {
+//
+// Session s;
+// Transaction tx;
+// s = openSession();
+// tx = s.beginTransaction();
+//
+// // create some test entities
+// Employer employer = new Employer();
+// Contractor contractor1 = new Contractor();
+// contractor1.setName( "Emmanuel" );
+// contractor1.setHourlyRate(100.0f);
+// Contractor contractor2 = new Contractor();
+// contractor2.setName( "Hardy" );
+// contractor2.setHourlyRate(99.99f);
+// s.persist( contractor1 );
+// s.persist( contractor2 );
+//
+// // add contractors to employer
+// List setOfContractors = new ArrayList();
+// setOfContractors.add( contractor1 );
+// setOfContractors.add( contractor2 );
+// employer.setContractors( setOfContractors );
+//
+// // add employer to contractors
+// Collection employerListContractor1 = new ArrayList();
+// employerListContractor1.add( employer );
+// contractor1.setEmployers( employerListContractor1 );
+//
+// Collection employerListContractor2 = new ArrayList();
+// employerListContractor2.add( employer );
+// contractor2.setEmployers( employerListContractor2 );
+//
+// s.flush();
+// s.clear();
+//
+// // assertions
+// employer = (Employer) s.get( Employer.class, employer.getId() );
+// assertNotNull( employer );
+// assertNotNull( employer.getContractors() );
+// assertEquals( 2, employer.getContractors().size() );
+// Contractor firstContractorFromDb = (Contractor) employer.getContractors().iterator().next();
+// assertEquals( contractor2.getName(), firstContractorFromDb.getName() );
+// tx.rollback();
+// s.close();
+// }
- s.flush();
- s.clear();
-
- // assertions
- employer = (Employer) s.get( Employer.class, employer.getId() );
- assertNotNull( employer );
- assertNotNull( employer.getContractors() );
- assertEquals( 2, employer.getContractors().size() );
- Contractor firstContractorFromDb = (Contractor) employer.getContractors().iterator().next();
- assertEquals( contractor2.getName(), firstContractorFromDb.getName() );
- tx.rollback();
- s.close();
- }
-
public void testRemoveInBetween() throws Exception {
Session s;
Transaction tx;
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/onetomany/OneToManyTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/onetomany/OneToManyTest.java 2008-10-30 19:08:58 UTC (rev 15455)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/onetomany/OneToManyTest.java 2008-10-31 10:26:47 UTC (rev 15456)
@@ -381,27 +381,27 @@
s.close();
}
- @RequiresDialect(HSQLDialect.class)
- public void testOrderByOnSuperclassProperty() {
- OrganisationUser user = new OrganisationUser();
- user.setFirstName( "Emmanuel" );
- user.setLastName( "Bernard" );
- user.setIdPerson( new Long(1) );
- user.setSomeText( "SomeText" );
- Organisation org = new Organisation();
- org.setIdOrganisation( new Long(1) );
- org.setName( "S Diego Zoo" );
- user.setOrganisation( org );
- Session s = openSession();
- s.getTransaction().begin();
- s.persist( user );
- s.persist( org );
- s.flush();
- s.clear();
- s.createQuery( "select org from Organisation org left join fetch org.organisationUsers" ).list();
- s.getTransaction().rollback();
- s.close();
- }
+// HHH-3577
+// public void testOrderByOnSuperclassProperty() {
+// OrganisationUser user = new OrganisationUser();
+// user.setFirstName( "Emmanuel" );
+// user.setLastName( "Bernard" );
+// user.setIdPerson( new Long(1) );
+// user.setSomeText( "SomeText" );
+// Organisation org = new Organisation();
+// org.setIdOrganisation( new Long(1) );
+// org.setName( "S Diego Zoo" );
+// user.setOrganisation( org );
+// Session s = openSession();
+// s.getTransaction().begin();
+// s.persist( user );
+// s.persist( org );
+// s.flush();
+// s.clear();
+// s.createQuery( "select org from Organisation org left join fetch org.organisationUsers" ).list();
+// s.getTransaction().rollback();
+// s.close();
+// }
/**
* @see org.hibernate.test.annotations.TestCase#getMappings()
Modified: core/trunk/annotations/src/test/resources/hibernate.properties
===================================================================
--- core/trunk/annotations/src/test/resources/hibernate.properties 2008-10-30 19:08:58 UTC (rev 15455)
+++ core/trunk/annotations/src/test/resources/hibernate.properties 2008-10-31 10:26:47 UTC (rev 15456)
@@ -39,3 +39,5 @@
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
hibernate.cache.use_query_cache true
+
+# hibernate.jdbc.batch_size 0
16 years, 2 months
Hibernate SVN: r15455 - in core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2: functional/bulk and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2008-10-30 15:08:58 -0400 (Thu, 30 Oct 2008)
New Revision: 15455
Added:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCEntityReplicationTest.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCSessionRefreshTest.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/MVCCBulkOperationsTest.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/MVCCIsolatedClassLoaderTest.java
Modified:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java
Log:
Add MVCC-flavored functional tests
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCEntityReplicationTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCEntityReplicationTest.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCEntityReplicationTest.java 2008-10-30 19:08:58 UTC (rev 15455)
@@ -0,0 +1,47 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.functional;
+
+
+/**
+ * Executes the superclass tests, but with Hibernate and JBoss Cache
+ * configured for optimistic locking.
+ *
+ * @author Brian Stansberry
+ */
+public class MVCCEntityReplicationTest extends PessimisticEntityReplicationTest
+{
+
+ public MVCCEntityReplicationTest(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected String getEntityCacheConfigName()
+ {
+ return "mvcc-shared";
+ }
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCSessionRefreshTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCSessionRefreshTest.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCSessionRefreshTest.java 2008-10-30 19:08:58 UTC (rev 15455)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details. You should have received a
+ * copy of the GNU Lesser General Public License, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Brian Stansberry
+ */
+
+package org.hibernate.test.cache.jbc2.functional;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.hibernate.test.cache.jbc2.functional.util.IsolatedCacheTestSetup;
+
+/**
+ * A SessionRefreshTest that uses an OPTIMISTIC cache config.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MVCCSessionRefreshTest extends PessimisticSessionRefreshTest
+{
+
+ private static final String CACHE_CONFIG = "mvcc-entity";
+
+ /**
+ * Create a new OptimisticSessionRefreshTest.
+ *
+ * @param x
+ */
+ public MVCCSessionRefreshTest(String x)
+ {
+ super(x);
+ }
+
+ public static Test suite() throws Exception {
+ TestSuite suite = new TestSuite(MVCCSessionRefreshTest.class);
+ String[] acctClasses = { OUR_PACKAGE + ".Account", OUR_PACKAGE + ".AccountHolder" };
+ return new IsolatedCacheTestSetup(suite, acctClasses, CACHE_CONFIG);
+ }
+
+ @Override
+ protected String getEntityCacheConfigName() {
+ return CACHE_CONFIG;
+ }
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/MVCCBulkOperationsTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/MVCCBulkOperationsTest.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/MVCCBulkOperationsTest.java 2008-10-30 19:08:58 UTC (rev 15455)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.hibernate.test.cache.jbc2.functional.bulk;
+
+import junit.framework.Test;
+
+import org.hibernate.test.cache.jbc2.collection.OptimisticInvalidatedTransactionalTestCase;
+import org.hibernate.test.util.CacheTestUtil;
+
+
+/**
+ * Optimistic version of BulkOperationsUnitTestCase.
+ *
+ * @author Brian Stansberry
+ *
+ */
+public class MVCCBulkOperationsTest
+ extends PessimisticBulkOperationsTest
+{
+
+ public static Test suite() throws Exception {
+ return CacheTestUtil.createFailureExpectedSuite(MVCCBulkOperationsTest.class);
+ }
+
+ /**
+ * @param name
+ */
+ public MVCCBulkOperationsTest(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected String getEntityCacheConfigName()
+ {
+ return "mvcc-entity";
+ }
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/MVCCIsolatedClassLoaderTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/MVCCIsolatedClassLoaderTest.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/classloader/MVCCIsolatedClassLoaderTest.java 2008-10-30 19:08:58 UTC (rev 15455)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2007, Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, v. 2.1. This program is distributed in the
+ * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details. You should have received a
+ * copy of the GNU Lesser General Public License, v.2.1 along with this
+ * distribution; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Red Hat Author(s): Brian Stansberry
+ */
+
+package org.hibernate.test.cache.jbc2.functional.classloader;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.hibernate.test.cache.jbc2.functional.util.IsolatedCacheTestSetup;
+
+/**
+ * Optimistic locking version of IsolatedClassLoaderTest.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MVCCIsolatedClassLoaderTest extends PessimisticIsolatedClassLoaderTest
+{
+ private static final String CACHE_CONFIG = "mvcc-shared";
+
+ /**
+ * Create a new OptimisticIsolatedClassLoaderTest.
+ *
+ * @param name
+ */
+ public MVCCIsolatedClassLoaderTest(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception {
+ TestSuite suite = new TestSuite(MVCCIsolatedClassLoaderTest.class);
+ String[] acctClasses = { OUR_PACKAGE + ".Account", OUR_PACKAGE + ".AccountHolder" };
+ return new IsolatedCacheTestSetup(suite, acctClasses, CACHE_CONFIG);
+ }
+
+ protected String getEntityCacheConfigName() {
+ return CACHE_CONFIG;
+ }
+
+}
Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/query/QueryRegionImplTestCase.java 2008-10-30 19:08:58 UTC (rev 15455)
@@ -94,6 +94,10 @@
public void testPutDoesNotBlockGetPessimistic() throws Exception {
putDoesNotBlockGetTest("pessimistic-shared");
}
+
+ public void testPutDoesNotBlockGetMVCC() throws Exception {
+ putDoesNotBlockGetTest("mvcc-shared");
+ }
private void putDoesNotBlockGetTest(String configName) throws Exception {
@@ -190,6 +194,10 @@
getDoesNotBlockPutTest("pessimistic-shared-repeatable");
}
+ public void testGetDoesNotBlockPutMVCC() throws Exception {
+ getDoesNotBlockPutTest("mvcc-shared");
+ }
+
private void getDoesNotBlockPutTest(String configName) throws Exception {
Configuration cfg = createConfiguration(configName);
16 years, 2 months
Hibernate SVN: r15454 - in core/branches/JBOSS_CACHE_3/cache-jbosscache2/src: test/java/org/hibernate/test/cache/jbc2/collection and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2008-10-30 14:58:21 -0400 (Thu, 30 Oct 2008)
New Revision: 15454
Added:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccInvalidatedTransactionalTestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyExtraAPITestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyTestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReplicatedTransactionalTestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccTransactionalExtraAPITestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccInvalidatedTransactionalTestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyExtraAPITestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReplicatedTransactionalTestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccTransactionalExtraAPITestCase.java
Modified:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jbc2-configs.xml
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
Log:
Add Jason's MVCC tests
Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/main/resources/org/hibernate/cache/jbc2/builder/jbc2-configs.xml
===================================================================
(Binary files differ)
Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2008-10-30 16:45:35 UTC (rev 15453)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/AbstractCollectionRegionAccessStrategyTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -56,9 +56,9 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.transaction.BatchModeTransactionManager;
-/**
+/**
* Base class for tests of CollectionRegionAccessStrategy impls.
- *
+ *
* @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
* @version $Revision: 1 $
*/
@@ -68,44 +68,44 @@
public static final String KEY_BASE = "KEY";
public static final String VALUE1 = "VALUE1";
public static final String VALUE2 = "VALUE2";
-
+
protected static int testCount;
-
+
protected static Configuration localCfg;
protected static JBossCacheRegionFactory localRegionFactory;
protected static Cache localCache;
protected static Configuration remoteCfg;
protected static JBossCacheRegionFactory remoteRegionFactory;
protected static Cache remoteCache;
-
+
protected CollectionRegion localCollectionRegion;
protected CollectionRegionAccessStrategy localAccessStrategy;
protected CollectionRegion remoteCollectionRegion;
protected CollectionRegionAccessStrategy remoteAccessStrategy;
-
+
protected boolean invalidation;
protected boolean optimistic;
protected boolean synchronous;
-
+
protected Exception node1Exception;
protected Exception node2Exception;
-
+
protected AssertionFailedError node1Failure;
protected AssertionFailedError node2Failure;
-
+
public static Test getTestSetup(Class testClass, String configName) {
TestSuite suite = new TestSuite(testClass);
return new AccessStrategyTestSetup(suite, configName);
}
-
+
public static Test getTestSetup(Test test, String configName) {
return new AccessStrategyTestSetup(test, configName);
}
-
+
/**
* Create a new TransactionalAccessTestCase.
- *
+ *
* @param name
*/
public AbstractCollectionRegionAccessStrategyTestCase(String name) {
@@ -116,38 +116,38 @@
protected void setUp() throws Exception {
super.setUp();
-
+
// Sleep a bit to avoid concurrent FLUSH problem
avoidConcurrentFlush();
-
+
invalidation = CacheHelper.isClusteredInvalidation(localCache);
synchronous = CacheHelper.isSynchronous(localCache);
optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
localCollectionRegion = localRegionFactory.buildCollectionRegion(REGION_NAME, localCfg.getProperties(), getCacheDataDescription());
localAccessStrategy = localCollectionRegion.buildAccessStrategy(getAccessType());
-
+
// Sleep a bit to avoid concurrent FLUSH problem
avoidConcurrentFlush();
-
+
remoteCollectionRegion = remoteRegionFactory.buildCollectionRegion(REGION_NAME, remoteCfg.getProperties(), getCacheDataDescription());
remoteAccessStrategy = remoteCollectionRegion.buildAccessStrategy(getAccessType());
-
+
node1Exception = null;
node2Exception = null;
-
+
node1Failure = null;
node2Failure = null;
}
protected void tearDown() throws Exception {
-
+
super.tearDown();
-
+
if (localCollectionRegion != null)
localCollectionRegion.destroy();
if (remoteCollectionRegion != null)
remoteCollectionRegion.destroy();
-
+
try {
localCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
localCache.removeNode(Fqn.ROOT);
@@ -155,7 +155,7 @@
catch (Exception e) {
log.error("Problem purging local cache" ,e);
}
-
+
try {
remoteCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
remoteCache.removeNode(Fqn.ROOT);
@@ -163,14 +163,14 @@
catch (Exception e) {
log.error("Problem purging remote cache" ,e);
}
-
+
node1Exception = null;
node2Exception = null;
-
+
node1Failure = null;
node2Failure = null;
}
-
+
protected static Configuration createConfiguration(String configName, String configResource) {
Configuration cfg = CacheTestUtil.buildConfiguration(REGION_PREFIX, MultiplexedJBossCacheRegionFactory.class, true, false);
cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP, configName);
@@ -179,33 +179,38 @@
}
return cfg;
}
-
+
protected CacheDataDescription getCacheDataDescription() {
return new CacheDataDescriptionImpl(true, true, ComparableComparator.INSTANCE);
}
-
+
protected boolean isUsingOptimisticLocking() {
return optimistic;
}
-
+
+ public boolean isBlockingReads()
+ {
+ return !isUsingOptimisticLocking();
+ }
+
protected boolean isUsingInvalidation() {
return invalidation;
}
-
+
protected boolean isSynchronous() {
return synchronous;
}
-
+
protected Fqn getRegionFqn(String regionName, String regionPrefix) {
return BasicRegionAdapter.getTypeLastRegionFqn(regionName, regionPrefix, CollectionRegionImpl.TYPE);
}
-
+
/**
* This is just a setup test where we assert that the cache config is
* as we expected.
*/
public abstract void testCacheConfiguration();
-
+
/**
* Test method for {@link TransactionalAccess#getRegion()}.
*/
@@ -226,7 +231,7 @@
public void testPutFromLoadMinimal() throws Exception {
putFromLoadTest(true);
}
-
+
/**
* Simulate 2 nodes, both start, tx do a get, experience a cache miss,
* then 'read from db.' First does a putFromLoad, then an evict (to represent a change).
@@ -235,37 +240,37 @@
* both start a new tx and get. First should see the updated data;
* second should either see the updated data (isInvalidation()( == false)
* or null (isInvalidation() == true).
- *
+ *
* @param useMinimalAPI
* @throws Exception
*/
private void putFromLoadTest(final boolean useMinimalAPI) throws Exception {
-
+
final String KEY = KEY_BASE + testCount++;
-
+
final CountDownLatch writeLatch1 = new CountDownLatch(1);
final CountDownLatch writeLatch2 = new CountDownLatch(1);
final CountDownLatch completionLatch = new CountDownLatch(2);
-
- Thread node1 = new Thread() {
-
+
+ Thread node1 = new Thread() {
+
public void run() {
-
- try {
+
+ try {
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
-
+
assertEquals("node1 starts clean", null, localAccessStrategy.get(KEY, txTimestamp));
-
+
writeLatch1.await();
-
+
if (useMinimalAPI) {
- localAccessStrategy.putFromLoad(KEY, VALUE2, txTimestamp, new Integer(2), true);
+ localAccessStrategy.putFromLoad(KEY, VALUE2, txTimestamp, new Integer(2), true);
}
else {
localAccessStrategy.putFromLoad(KEY, VALUE2, txTimestamp, new Integer(2));
}
-
+
BatchModeTransactionManager.getInstance().commit();
}
catch (Exception e) {
@@ -284,32 +289,32 @@
}
}
};
-
+
Thread node2 = new Thread() {
-
- public void run() {
-
- try {
+
+ public void run() {
+
+ try {
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
-
+
assertNull("node2 starts clean", remoteAccessStrategy.get(KEY, txTimestamp));
-
+
// Let node1 write
writeLatch1.countDown();
// Wait for node1 to finish
writeLatch2.await();
-
+
// Let the first PFER propagate
sleep(200);
-
+
if (useMinimalAPI) {
- remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
+ remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
}
else {
remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1));
}
-
+
BatchModeTransactionManager.getInstance().commit();
}
catch (Exception e) {
@@ -326,26 +331,26 @@
}
}
};
-
+
node1.setDaemon(true);
node2.setDaemon(true);
-
+
node1.start();
- node2.start();
-
+ node2.start();
+
assertTrue("Threads completed", completionLatch.await(2, TimeUnit.SECONDS));
-
+
if (node1Failure != null)
throw node1Failure;
if (node2Failure != null)
throw node2Failure;
-
+
assertEquals("node1 saw no exceptions", null, node1Exception);
assertEquals("node2 saw no exceptions", null, node2Exception);
-
+
// let the final PFER propagate
sleep(100);
-
+
long txTimestamp = System.currentTimeMillis();
String msg1 = "Correct node1 value";
String msg2 = "Correct node2 value";
@@ -364,8 +369,8 @@
expected1 = VALUE2;
expected2 = VALUE2;
}
-
- assertEquals(msg1, expected1, localAccessStrategy.get(KEY, txTimestamp));
+
+ assertEquals(msg1, expected1, localAccessStrategy.get(KEY, txTimestamp));
assertEquals(msg2, expected2, remoteAccessStrategy.get(KEY, txTimestamp));
}
@@ -385,7 +390,7 @@
/**
* Test method for {@link TransactionalAccess#evict(java.lang.Object)}.
- *
+ *
* FIXME add testing of the "immediately without regard for transaction
* isolation" bit in the CollectionRegionAccessStrategy API.
*/
@@ -395,7 +400,7 @@
/**
* Test method for {@link TransactionalAccess#evictAll()}.
- *
+ *
* FIXME add testing of the "immediately without regard for transaction
* isolation" bit in the CollectionRegionAccessStrategy API.
*/
@@ -404,41 +409,41 @@
}
private void evictOrRemoveTest(boolean evict) {
-
+
final String KEY = KEY_BASE + testCount++;
-
+
assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
// Wait for async propagation
sleep(250);
-
+
if (evict)
localAccessStrategy.evict(KEY);
else
localAccessStrategy.remove(KEY);
-
+
assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
}
private void evictOrRemoveAllTest(boolean evict) {
-
+
final String KEY = KEY_BASE + testCount++;
-
+
Fqn regionFqn = getRegionFqn(REGION_NAME, REGION_PREFIX);
-
+
Node regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
-
+
if (isUsingOptimisticLocking()) {
assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
}
@@ -447,37 +452,37 @@
assertFalse(regionRoot == null);
assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
-
+
if (isUsingOptimisticLocking()) {
assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
}
-
+
assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
// Wait for async propagation
sleep(250);
-
+
if (isUsingOptimisticLocking()) {
regionRoot = localCache.getRoot().getChild(regionFqn);
assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
}
-
+
if (evict)
localAccessStrategy.evictAll();
else
localAccessStrategy.removeAll();
-
+
// This should re-establish the region root node in the optimistic case
assertNull(localAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
regionRoot = localCache.getRoot().getChild(regionFqn);
if (isUsingOptimisticLocking()) {
assertFalse(regionRoot == null);
@@ -489,7 +494,7 @@
assertTrue("region root is removed", regionRoot == null || !regionRoot.isValid());
}
- // Re-establishing the region root on the local node doesn't
+ // Re-establishing the region root on the local node doesn't
// propagate it to other nodes. Do a get on the remote node to re-establish
// This only adds a node in the case of optimistic locking
assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
@@ -501,15 +506,15 @@
assertTrue(regionRoot.isResident());
// Not invalidation, so we didn't insert a child above
assertEquals(0, getValidChildrenCount(regionRoot));
- }
+ }
else {
assertTrue("region root is removed", regionRoot == null || !regionRoot.isValid());
}
-
+
// Test whether the get above messes up the optimistic version
remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
// Revalidate the region root
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
@@ -517,14 +522,14 @@
assertTrue(regionRoot.isResident());
// Region root should have 1 child -- the one we added above
assertEquals(1, getValidChildrenCount(regionRoot));
-
+
// Wait for async propagation of the putFromLoad
sleep(250);
-
+
assertEquals("local is correct", (isUsingInvalidation() ? null : VALUE1), localAccessStrategy.get(KEY, System.currentTimeMillis()));
assertEquals("remote is correct", VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
}
-
+
private int getValidChildrenCount(Node node) {
int result = 0;
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
@@ -532,9 +537,9 @@
result++;
}
}
- return result;
+ return result;
}
-
+
private void rollback() {
try {
BatchModeTransactionManager.getInstance().rollback();
@@ -542,21 +547,21 @@
catch (Exception e) {
log.error(e.getMessage(), e);
}
-
+
}
-
+
private static class AccessStrategyTestSetup extends TestSetup {
-
+
private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
-
+
private final String configResource;
private final String configName;
private String preferIPv4Stack;
-
+
public AccessStrategyTestSetup(Test test, String configName) {
this(test, configName, null);
}
-
+
public AccessStrategyTestSetup(Test test, String configName, String configResource) {
super(test);
this.configName = configName;
@@ -565,41 +570,41 @@
@Override
protected void setUp() throws Exception {
- super.setUp();
-
- // Try to ensure we use IPv4; otherwise cluster formation is very slow
+ super.setUp();
+
+ // Try to ensure we use IPv4; otherwise cluster formation is very slow
preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
System.setProperty(PREFER_IPV4STACK, "true");
-
+
localCfg = createConfiguration(configName, configResource);
localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
localCache = localRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
-
+
remoteCfg = createConfiguration(configName, configResource);
remoteRegionFactory = CacheTestUtil.startRegionFactory(remoteCfg);
remoteCache = remoteRegionFactory.getCacheInstanceManager().getCollectionCacheInstance();
}
@Override
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception {
try {
super.tearDown();
}
finally {
if (preferIPv4Stack == null)
System.clearProperty(PREFER_IPV4STACK);
- else
- System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
+ else
+ System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
}
-
+
if (localRegionFactory != null)
localRegionFactory.stop();
-
+
if (remoteRegionFactory != null)
remoteRegionFactory.stop();
}
-
-
+
+
}
}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccInvalidatedTransactionalTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccInvalidatedTransactionalTestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccInvalidatedTransactionalTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,62 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import org.hibernate.test.util.CacheTestUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests TRANSACTIONAL access when pessimistic locking and invalidation are used.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccInvalidatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
+
+ /**
+ * Create a new PessimisticTransactionalAccessTestCase.
+ *
+ * @param name
+ */
+ public MvccInvalidatedTransactionalTestCase(String name) {
+ super(name);
+ }
+
+ public static Test suite() throws Exception {
+ TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccInvalidatedTransactionalTestCase.class);
+ return getTestSetup(suite, "mvcc-entity");
+ }
+
+ @Override
+ public void testCacheConfiguration() {
+ assertTrue("Using Invalidation", isUsingInvalidation());
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ assertTrue("Synchronous mode", isSynchronous());
+ }
+
+ // Known failures
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyExtraAPITestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyExtraAPITestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyExtraAPITestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,72 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import org.hibernate.cache.access.CollectionRegionAccessStrategy;
+
+/**
+ * Tests for the "extra API" in EntityRegionAccessStrategy; in this
+ * version using pessimistic locking with READ_ONLY access.
+ * <p>
+ * By "extra API" we mean those methods that are superfluous to the
+ * function of the JBC integration, where the impl is a no-op or a static
+ * false return value, UnsupportedOperationException, etc.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReadOnlyExtraAPITestCase extends OptimisticReadOnlyExtraAPITestCase {
+
+ private static CollectionRegionAccessStrategy localAccessStrategy;
+
+ /**
+ * Create a new PessimisticAccessStrategyExtraAPITestCase.
+ *
+ * @param name
+ */
+ public MvccReadOnlyExtraAPITestCase(String name) {
+ super(name);
+ }
+
+ @Override
+ protected String getCacheConfigName() {
+ return "mvcc-entity";
+ }
+
+ @Override
+ protected CollectionRegionAccessStrategy getCollectionAccessStrategy() {
+ return localAccessStrategy;
+ }
+
+ @Override
+ protected void setCollectionAccessStrategy(CollectionRegionAccessStrategy strategy) {
+ localAccessStrategy = strategy;
+ }
+
+ @Override
+ public void testCacheConfiguration() {
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ }
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyTestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReadOnlyTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,63 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import org.hibernate.test.util.CacheTestUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests READ_ONLY access when pessimistic locking and invalidation are used.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReadOnlyTestCase extends AbstractReadOnlyAccessTestCase {
+
+ /**
+ * Create a new PessimisticTransactionalAccessTestCase.
+ *
+ * @param name
+ */
+ public MvccReadOnlyTestCase(String name) {
+ super(name);
+ }
+
+ public static Test suite() throws Exception {
+ TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccReadOnlyTestCase.class);
+ return getTestSetup(suite, "mvcc-entity");
+ }
+
+ // Known failures
+
+ // Overrides
+
+ @Override
+ public void testCacheConfiguration() {
+ assertTrue("Using Invalidation", isUsingInvalidation());
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ }
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReplicatedTransactionalTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReplicatedTransactionalTestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccReplicatedTransactionalTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,58 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import junit.framework.Test;
+
+/**
+ * Tests TRANSACTIONAL access when pessimistic locking and replication are used.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReplicatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
+
+ /**
+ * Create a new PessimisticTransactionalAccessTestCase.
+ *
+ * @param name
+ */
+ public MvccReplicatedTransactionalTestCase(String name) {
+ super(name);
+ }
+
+ public static Test suite() throws Exception {
+ return getTestSetup(MvccReplicatedTransactionalTestCase.class, "mvcc-shared");
+ }
+
+ @Override
+ public void testCacheConfiguration() {
+ assertFalse("Using Invalidation", isUsingInvalidation());
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ assertTrue("Synchronous mode", isSynchronous());
+ }
+
+
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccTransactionalExtraAPITestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccTransactionalExtraAPITestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/MvccTransactionalExtraAPITestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,72 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.collection;
+
+import org.hibernate.cache.access.CollectionRegionAccessStrategy;
+
+/**
+ * Tests for the "extra API" in EntityRegionAccessStrategy; in this base
+ * version using Optimistic locking with TRANSACTIONAL access.
+ * <p>
+ * By "extra API" we mean those methods that are superfluous to the
+ * function of the JBC integration, where the impl is a no-op or a static
+ * false return value, UnsupportedOperationException, etc.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccTransactionalExtraAPITestCase extends OptimisticTransactionalExtraAPITestCase {
+
+ private static CollectionRegionAccessStrategy localAccessStrategy;
+
+ /**
+ * Create a new PessimisticAccessStrategyExtraAPITestCase.
+ *
+ * @param name
+ */
+ public MvccTransactionalExtraAPITestCase(String name) {
+ super(name);
+ }
+
+ @Override
+ protected String getCacheConfigName() {
+ return "mvcc-entity";
+ }
+
+ @Override
+ protected CollectionRegionAccessStrategy getCollectionAccessStrategy() {
+ return localAccessStrategy;
+ }
+
+ @Override
+ protected void setCollectionAccessStrategy(CollectionRegionAccessStrategy strategy) {
+ localAccessStrategy = strategy;
+ }
+
+ @Override
+ public void testCacheConfiguration() {
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ }
+
+}
Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2008-10-30 16:45:35 UTC (rev 15453)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/AbstractEntityRegionAccessStrategyTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -55,9 +55,9 @@
import org.jboss.cache.NodeSPI;
import org.jboss.cache.transaction.BatchModeTransactionManager;
-/**
+/**
* Base class for tests of EntityRegionAccessStrategy impls.
- *
+ *
* @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
* @version $Revision: 1 $
*/
@@ -67,54 +67,54 @@
public static final String KEY_BASE = "KEY";
public static final String VALUE1 = "VALUE1";
public static final String VALUE2 = "VALUE2";
-
+
protected static int testCount;
-
+
protected static Configuration localCfg;
protected static JBossCacheRegionFactory localRegionFactory;
protected static Cache localCache;
protected static Configuration remoteCfg;
protected static JBossCacheRegionFactory remoteRegionFactory;
protected static Cache remoteCache;
-
+
protected static boolean invalidation;
protected static boolean optimistic;
protected static boolean synchronous;
-
+
protected EntityRegion localEntityRegion;
protected EntityRegionAccessStrategy localAccessStrategy;
protected EntityRegion remoteEntityRegion;
protected EntityRegionAccessStrategy remoteAccessStrategy;
-
+
protected Exception node1Exception;
protected Exception node2Exception;
-
+
protected AssertionFailedError node1Failure;
protected AssertionFailedError node2Failure;
-
-
+
+
public static Test getTestSetup(Class testClass, String configName) {
return getTestSetup(testClass, configName, null);
}
-
+
public static Test getTestSetup(Test test, String configName) {
return getTestSetup(test, configName, null);
- }
-
+ }
+
public static Test getTestSetup(Class testClass, String configName, String configResource) {
TestSuite suite = new TestSuite(testClass);
return new AccessStrategyTestSetup(suite, configName, configResource);
}
-
+
public static Test getTestSetup(Test test, String configName, String configResource) {
return new AccessStrategyTestSetup(test, configName, configResource);
}
-
-
+
+
/**
* Create a new TransactionalAccessTestCase.
- *
+ *
* @param name
*/
public AbstractEntityRegionAccessStrategyTestCase(String name) {
@@ -125,35 +125,35 @@
protected void setUp() throws Exception {
super.setUp();
-
+
// Sleep a bit to avoid concurrent FLUSH problem
avoidConcurrentFlush();
-
+
localEntityRegion = localRegionFactory.buildEntityRegion(REGION_NAME, localCfg.getProperties(), getCacheDataDescription());
localAccessStrategy = localEntityRegion.buildAccessStrategy(getAccessType());
-
+
// Sleep a bit to avoid concurrent FLUSH problem
avoidConcurrentFlush();
-
+
remoteEntityRegion = remoteRegionFactory.buildEntityRegion(REGION_NAME, remoteCfg.getProperties(), getCacheDataDescription());
remoteAccessStrategy = remoteEntityRegion.buildAccessStrategy(getAccessType());
-
+
node1Exception = null;
node2Exception = null;
-
+
node1Failure = null;
node2Failure = null;
}
protected void tearDown() throws Exception {
-
+
super.tearDown();
-
+
if (localEntityRegion != null)
localEntityRegion.destroy();
if (remoteEntityRegion != null)
remoteEntityRegion.destroy();
-
+
try {
localCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
localCache.removeNode(Fqn.ROOT);
@@ -161,7 +161,7 @@
catch (Exception e) {
log.error("Problem purging local cache" ,e);
}
-
+
try {
remoteCache.getInvocationContext().getOptionOverrides().setCacheModeLocal(true);
remoteCache.removeNode(Fqn.ROOT);
@@ -169,14 +169,14 @@
catch (Exception e) {
log.error("Problem purging remote cache" ,e);
}
-
+
node1Exception = null;
node2Exception = null;
-
+
node1Failure = null;
node2Failure = null;
}
-
+
protected static Configuration createConfiguration(String configName, String configResource) {
Configuration cfg = CacheTestUtil.buildConfiguration(REGION_PREFIX, MultiplexedJBossCacheRegionFactory.class, true, false);
cfg.setProperty(MultiplexingCacheInstanceManager.ENTITY_CACHE_RESOURCE_PROP, configName);
@@ -185,23 +185,23 @@
}
return cfg;
}
-
+
protected CacheDataDescription getCacheDataDescription() {
return new CacheDataDescriptionImpl(true, true, ComparableComparator.INSTANCE);
}
-
+
protected boolean isUsingOptimisticLocking() {
return optimistic;
}
-
+
protected boolean isUsingInvalidation() {
return invalidation;
}
-
+
protected boolean isSynchronous() {
return synchronous;
}
-
+
protected Fqn getRegionFqn(String regionName, String regionPrefix) {
return BasicRegionAdapter.getTypeLastRegionFqn(regionName, regionPrefix, EntityRegionImpl.TYPE);
}
@@ -212,24 +212,24 @@
throw node1Failure;
if (node2Failure != null)
throw node2Failure;
-
+
if (node1Exception != null) {
log.error("node1 saw an exception", node1Exception);
assertEquals("node1 saw no exceptions", null, node1Exception);
}
-
+
if (node2Exception != null) {
log.error("node2 saw an exception", node2Exception);
assertEquals("node2 saw no exceptions", null, node2Exception);
}
}
-
+
/**
* This is just a setup test where we assert that the cache config is
* as we expected.
*/
public abstract void testCacheConfiguration();
-
+
/**
* Test method for {@link TransactionalAccess#getRegion()}.
*/
@@ -250,7 +250,7 @@
public void testPutFromLoadMinimal() throws Exception {
putFromLoadTest(true);
}
-
+
/**
* Simulate 2 nodes, both start, tx do a get, experience a cache miss,
* then 'read from db.' First does a putFromLoad, then an update.
@@ -259,39 +259,39 @@
* both start a new tx and get. First should see the updated data;
* second should either see the updated data (isInvalidation() == false)
* or null (isInvalidation() == true).
- *
+ *
* @param useMinimalAPI
* @throws Exception
*/
private void putFromLoadTest(final boolean useMinimalAPI) throws Exception {
-
+
final String KEY = KEY_BASE + testCount++;
-
+
final CountDownLatch writeLatch1 = new CountDownLatch(1);
final CountDownLatch writeLatch2 = new CountDownLatch(1);
final CountDownLatch completionLatch = new CountDownLatch(2);
-
- Thread node1 = new Thread() {
-
+
+ Thread node1 = new Thread() {
+
public void run() {
-
- try {
+
+ try {
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
-
+
assertNull("node1 starts clean", localAccessStrategy.get(KEY, txTimestamp));
-
+
writeLatch1.await();
-
+
if (useMinimalAPI) {
- localAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
+ localAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
}
else {
localAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1));
}
-
+
localAccessStrategy.update(KEY, VALUE2, new Integer(2), new Integer(1));
-
+
BatchModeTransactionManager.getInstance().commit();
}
catch (Exception e) {
@@ -310,29 +310,29 @@
}
}
};
-
+
Thread node2 = new Thread() {
-
- public void run() {
-
- try {
+
+ public void run() {
+
+ try {
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
-
+
assertNull("node1 starts clean", remoteAccessStrategy.get(KEY, txTimestamp));
-
+
// Let node1 write
writeLatch1.countDown();
// Wait for node1 to finish
writeLatch2.await();
-
+
if (useMinimalAPI) {
- remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
+ remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1), true);
}
else {
remoteAccessStrategy.putFromLoad(KEY, VALUE1, txTimestamp, new Integer(1));
}
-
+
BatchModeTransactionManager.getInstance().commit();
}
catch (Exception e) {
@@ -349,32 +349,32 @@
}
}
};
-
+
node1.setDaemon(true);
node2.setDaemon(true);
-
+
node1.start();
- node2.start();
-
+ node2.start();
+
assertTrue("Threads completed", completionLatch.await(2, TimeUnit.SECONDS));
-
+
assertThreadsRanCleanly();
-
+
long txTimestamp = System.currentTimeMillis();
assertEquals("Correct node1 value", VALUE2, localAccessStrategy.get(KEY, txTimestamp));
-
+
if (isUsingInvalidation()) {
if (isUsingOptimisticLocking())
- // The node is "deleted" but it's ghost data version prevents the stale node2 PFER
+ // The node is "deleted" but it's ghost data version prevents the stale node2 PFER
assertEquals("Correct node2 value", null, remoteAccessStrategy.get(KEY, txTimestamp));
else {
// no data version to prevent the PFER; we count on db locks preventing this
- assertEquals("Expected node2 value", VALUE1, remoteAccessStrategy.get(KEY, txTimestamp));
+ assertEquals("Expected node2 value", VALUE1, remoteAccessStrategy.get(KEY, txTimestamp));
}
}
else {
// The node1 update is replicated, preventing the node2 PFER
- assertEquals("Correct node2 value", VALUE2, remoteAccessStrategy.get(KEY, txTimestamp));
+ assertEquals("Correct node2 value", VALUE2, remoteAccessStrategy.get(KEY, txTimestamp));
}
}
@@ -382,28 +382,28 @@
* Test method for {@link TransactionalAccess#insert(java.lang.Object, java.lang.Object, java.lang.Object)}.
*/
public void testInsert() throws Exception {
-
+
final String KEY = KEY_BASE + testCount++;
-
+
final CountDownLatch readLatch = new CountDownLatch(1);
final CountDownLatch commitLatch = new CountDownLatch(1);
final CountDownLatch completionLatch = new CountDownLatch(2);
-
- Thread inserter = new Thread() {
-
+
+ Thread inserter = new Thread() {
+
public void run() {
-
- try {
+
+ try {
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
-
+
assertNull("Correct initial value", localAccessStrategy.get(KEY, txTimestamp));
-
+
localAccessStrategy.insert(KEY, VALUE1, new Integer(1));
-
+
readLatch.countDown();
commitLatch.await();
-
+
BatchModeTransactionManager.getInstance().commit();
}
catch (Exception e) {
@@ -420,20 +420,20 @@
}
}
};
-
- Thread reader = new Thread() {
-
+
+ Thread reader = new Thread() {
+
public void run() {
-
- try {
+
+ try {
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
-
+
readLatch.await();
- Object expected = isUsingOptimisticLocking() ? null : VALUE1;
-
+ Object expected = !isBlockingReads() ? null : VALUE1;
+
assertEquals("Correct initial value", expected, localAccessStrategy.get(KEY, txTimestamp));
-
+
BatchModeTransactionManager.getInstance().commit();
}
catch (Exception e) {
@@ -451,13 +451,13 @@
}
}
};
-
+
inserter.setDaemon(true);
reader.setDaemon(true);
inserter.start();
reader.start();
-
- if (isUsingOptimisticLocking())
+
+ if (! isBlockingReads())
assertTrue("Threads completed", completionLatch.await(1, TimeUnit.SECONDS));
else {
// Reader should be blocking for lock
@@ -465,48 +465,53 @@
commitLatch.countDown();
assertTrue("Threads completed", completionLatch.await(1, TimeUnit.SECONDS));
}
-
+
assertThreadsRanCleanly();
-
+
long txTimestamp = System.currentTimeMillis();
assertEquals("Correct node1 value", VALUE1, localAccessStrategy.get(KEY, txTimestamp));
Object expected = isUsingInvalidation() ? null : VALUE1;
assertEquals("Correct node2 value", expected, remoteAccessStrategy.get(KEY, txTimestamp));
}
+ public boolean isBlockingReads()
+ {
+ return !isUsingOptimisticLocking();
+ }
+
/**
* Test method for {@link TransactionalAccess#update(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object)}.
*/
public void testUpdate() throws Exception {
-
+
final String KEY = KEY_BASE + testCount++;
-
+
// Set up initial state
localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
-
+
// Let the async put propagate
sleep(250);
-
+
final CountDownLatch readLatch = new CountDownLatch(1);
final CountDownLatch commitLatch = new CountDownLatch(1);
final CountDownLatch completionLatch = new CountDownLatch(2);
-
- Thread updater = new Thread() {
-
+
+ Thread updater = new Thread() {
+
public void run() {
-
- try {
+
+ try {
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
-
+
assertEquals("Correct initial value", VALUE1, localAccessStrategy.get(KEY, txTimestamp));
-
+
localAccessStrategy.update(KEY, VALUE2, new Integer(2), new Integer(1));
-
+
readLatch.countDown();
commitLatch.await();
-
+
BatchModeTransactionManager.getInstance().commit();
}
catch (Exception e) {
@@ -523,22 +528,22 @@
}
}
};
-
- Thread reader = new Thread() {
-
- public void run() {
- try {
+
+ Thread reader = new Thread() {
+
+ public void run() {
+ try {
long txTimestamp = System.currentTimeMillis();
BatchModeTransactionManager.getInstance().begin();
-
+
readLatch.await();
-
+
// This will block w/ pessimistic locking and then
// read the new value; w/ optimistic it shouldn't
// block and will read the old value
- Object expected = isUsingOptimisticLocking() ? VALUE1 : VALUE2;
+ Object expected = !isBlockingReads() ? VALUE1 : VALUE2;
assertEquals("Correct value", expected, localAccessStrategy.get(KEY, txTimestamp));
-
+
BatchModeTransactionManager.getInstance().commit();
}
catch (Exception e) {
@@ -553,28 +558,28 @@
finally {
commitLatch.countDown();
completionLatch.countDown();
- }
+ }
}
};
-
+
updater.setDaemon(true);
reader.setDaemon(true);
updater.start();
reader.start();
-
- if (isUsingOptimisticLocking())
+
+ if (! isBlockingReads())
// Should complete promptly
assertTrue(completionLatch.await(1, TimeUnit.SECONDS));
- else {
+ else {
// Reader thread should be blocking
assertFalse(completionLatch.await(250, TimeUnit.MILLISECONDS));
// Let the writer commit down
commitLatch.countDown();
assertTrue(completionLatch.await(1, TimeUnit.SECONDS));
}
-
+
assertThreadsRanCleanly();
-
+
long txTimestamp = System.currentTimeMillis();
assertEquals("Correct node1 value", VALUE2, localAccessStrategy.get(KEY, txTimestamp));
Object expected = isUsingInvalidation() ? null : VALUE2;
@@ -597,7 +602,7 @@
/**
* Test method for {@link TransactionalAccess#evict(java.lang.Object)}.
- *
+ *
* FIXME add testing of the "immediately without regard for transaction
* isolation" bit in the EntityRegionAccessStrategy API.
*/
@@ -607,7 +612,7 @@
/**
* Test method for {@link TransactionalAccess#evictAll()}.
- *
+ *
* FIXME add testing of the "immediately without regard for transaction
* isolation" bit in the EntityRegionAccessStrategy API.
*/
@@ -616,43 +621,43 @@
}
private void evictOrRemoveTest(boolean evict) {
-
+
final String KEY = KEY_BASE + testCount++;
-
+
assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
// Wait for async propagation
sleep(250);
-
+
if (evict)
localAccessStrategy.evict(KEY);
else
localAccessStrategy.remove(KEY);
-
+
assertEquals(null, localAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
// sleep(1000);
-
+
assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
}
private void evictOrRemoveAllTest(boolean evict) {
-
+
final String KEY = KEY_BASE + testCount++;
-
+
Fqn regionFqn = getRegionFqn(REGION_NAME, REGION_PREFIX);
-
+
Node regionRoot = localCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
-
+
if (isUsingOptimisticLocking()) {
assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
}
@@ -661,41 +666,41 @@
assertFalse(regionRoot == null);
assertEquals(0, getValidChildrenCount(regionRoot));
assertTrue(regionRoot.isResident());
-
+
if (isUsingOptimisticLocking()) {
assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
}
-
+
assertNull("local is clean", localAccessStrategy.get(KEY, System.currentTimeMillis()));
assertNull("remote is clean", remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
localAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, localAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
// Wait for async propagation
sleep(250);
-
+
remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
// Wait for async propagation
sleep(250);
-
+
if (isUsingOptimisticLocking()) {
regionRoot = localCache.getRoot().getChild(regionFqn);
assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertEquals(NonLockingDataVersion.class, ((NodeSPI) regionRoot).getVersion().getClass());
}
-
+
if (evict)
localAccessStrategy.evictAll();
else
localAccessStrategy.removeAll();
-
+
// This should re-establish the region root node in the optimistic case
assertNull(localAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
regionRoot = localCache.getRoot().getChild(regionFqn);
if (isUsingOptimisticLocking()) {
assertFalse(regionRoot == null);
@@ -707,7 +712,7 @@
assertTrue("region root is removed", regionRoot == null || !regionRoot.isValid());
}
- // Re-establishing the region root on the local node doesn't
+ // Re-establishing the region root on the local node doesn't
// propagate it to other nodes. Do a get on the remote node to re-establish
assertEquals(null, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
@@ -718,15 +723,15 @@
assertTrue(regionRoot.isResident());
// Not invalidation, so we didn't insert a child above
assertEquals(0, getValidChildrenCount(regionRoot));
- }
+ }
else {
assertTrue("region root is removed", regionRoot == null || !regionRoot.isValid());
}
-
+
// Test whether the get above messes up the optimistic version
remoteAccessStrategy.putFromLoad(KEY, VALUE1, System.currentTimeMillis(), new Integer(1));
assertEquals(VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
-
+
// Revalidate the region root
regionRoot = remoteCache.getRoot().getChild(regionFqn);
assertFalse(regionRoot == null);
@@ -734,14 +739,14 @@
assertTrue(regionRoot.isResident());
// Region root should have 1 child -- the one we added above
assertEquals(1, getValidChildrenCount(regionRoot));
-
+
// Wait for async propagation
sleep(250);
-
+
assertEquals("local is correct", (isUsingInvalidation() ? null : VALUE1), localAccessStrategy.get(KEY, System.currentTimeMillis()));
assertEquals("remote is correct", VALUE1, remoteAccessStrategy.get(KEY, System.currentTimeMillis()));
}
-
+
private int getValidChildrenCount(Node node) {
int result = 0;
for (Iterator it = node.getChildren().iterator(); it.hasNext(); ) {
@@ -749,9 +754,9 @@
result++;
}
}
- return result;
+ return result;
}
-
+
protected void rollback() {
try {
BatchModeTransactionManager.getInstance().rollback();
@@ -759,21 +764,21 @@
catch (Exception e) {
log.error(e.getMessage(), e);
}
-
+
}
-
+
private static class AccessStrategyTestSetup extends TestSetup {
-
+
private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";
-
+
private final String configResource;
private final String configName;
private String preferIPv4Stack;
-
+
public AccessStrategyTestSetup(Test test, String configName) {
this(test, configName, null);
}
-
+
public AccessStrategyTestSetup(Test test, String configName, String configResource) {
super(test);
this.configName = configName;
@@ -788,39 +793,39 @@
finally {
if (preferIPv4Stack == null)
System.clearProperty(PREFER_IPV4STACK);
- else
- System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
+ else
+ System.setProperty(PREFER_IPV4STACK, preferIPv4Stack);
}
-
- // Try to ensure we use IPv4; otherwise cluster formation is very slow
+
+ // Try to ensure we use IPv4; otherwise cluster formation is very slow
preferIPv4Stack = System.getProperty(PREFER_IPV4STACK);
System.setProperty(PREFER_IPV4STACK, "true");
-
+
localCfg = createConfiguration(configName, configResource);
localRegionFactory = CacheTestUtil.startRegionFactory(localCfg);
localCache = localRegionFactory.getCacheInstanceManager().getEntityCacheInstance();
-
+
remoteCfg = createConfiguration(configName, configResource);
remoteRegionFactory = CacheTestUtil.startRegionFactory(remoteCfg);
remoteCache = remoteRegionFactory.getCacheInstanceManager().getEntityCacheInstance();
-
+
invalidation = CacheHelper.isClusteredInvalidation(localCache);
synchronous = CacheHelper.isSynchronous(localCache);
optimistic = localCache.getConfiguration().getNodeLockingScheme() == org.jboss.cache.config.Configuration.NodeLockingScheme.OPTIMISTIC;
}
@Override
- protected void tearDown() throws Exception {
+ protected void tearDown() throws Exception {
super.tearDown();
-
+
if (localRegionFactory != null)
localRegionFactory.stop();
-
+
if (remoteRegionFactory != null)
remoteRegionFactory.stop();
}
-
-
+
+
}
}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccInvalidatedTransactionalTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccInvalidatedTransactionalTestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccInvalidatedTransactionalTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,68 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import org.hibernate.test.util.CacheTestUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests TRANSACTIONAL access when MVCC locking and invalidation are used.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccInvalidatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
+
+ /**
+ * Create a new PessimisticTransactionalAccessTestCase.
+ *
+ * @param name
+ */
+ public MvccInvalidatedTransactionalTestCase(String name) {
+ super(name);
+ }
+
+ public static Test suite() throws Exception {
+ TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccInvalidatedTransactionalTestCase.class);
+ return getTestSetup(suite, "mvcc-entity");
+ }
+
+ // Known failures
+
+ // Overrides
+
+ @Override
+ public void testCacheConfiguration() {
+ assertTrue("Using Invalidation", isUsingInvalidation());
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ assertTrue("Synchronous mode", isSynchronous());
+ }
+
+ @Override
+ public boolean isBlockingReads() {
+ return false;
+ }
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyExtraAPITestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyExtraAPITestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyExtraAPITestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,71 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import org.hibernate.cache.access.EntityRegionAccessStrategy;
+
+/**
+ * Tests for the "extra API" in EntityRegionAccessStrategy; in this
+ * version using pessimistic locking with READ_ONLY access.
+ * <p>
+ * By "extra API" we mean those methods that are superfluous to the
+ * function of the JBC integration, where the impl is a no-op or a static
+ * false return value, UnsupportedOperationException, etc.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReadOnlyExtraAPITestCase extends OptimisticReadOnlyExtraAPITestCase {
+
+ private static EntityRegionAccessStrategy localAccessStrategy;
+
+ /**
+ * Create a new PessimisticAccessStrategyExtraAPITestCase.
+ *
+ * @param name
+ */
+ public MvccReadOnlyExtraAPITestCase(String name) {
+ super(name);
+ }
+
+ @Override
+ protected String getCacheConfigName() {
+ return "mvcc-entity";
+ }
+
+ @Override
+ protected EntityRegionAccessStrategy getEntityAccessStrategy() {
+ return localAccessStrategy;
+ }
+
+ @Override
+ protected void setEntityRegionAccessStrategy(EntityRegionAccessStrategy strategy) {
+ localAccessStrategy = strategy;
+ }
+
+ @Override
+ public void testCacheConfiguration() {
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ }
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReadOnlyTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,68 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import org.hibernate.test.util.CacheTestUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Tests READ_ONLY access when pessimistic locking and invalidation are used.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReadOnlyTestCase extends AbstractReadOnlyAccessTestCase {
+
+ /**
+ * Create a new PessimisticTransactionalAccessTestCase.
+ *
+ * @param name
+ */
+ public MvccReadOnlyTestCase(String name) {
+ super(name);
+ }
+
+ public static Test suite() throws Exception {
+ TestSuite suite = CacheTestUtil.createFailureExpectedSuite(MvccReadOnlyTestCase.class);
+ return getTestSetup(suite, "mvcc-entity");
+ }
+
+ // Known failures
+
+ // Overrides
+
+
+ @Override
+ public void testCacheConfiguration() {
+ assertTrue("Using Invalidation", isUsingInvalidation());
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ }
+
+ @Override
+ public boolean isBlockingReads() {
+ return false;
+ }
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReplicatedTransactionalTestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReplicatedTransactionalTestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccReplicatedTransactionalTestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,62 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import junit.framework.Test;
+
+/**
+ * Tests TRANSACTIONAL access when pessimistic locking and replication are used.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccReplicatedTransactionalTestCase extends AbstractTransactionalAccessTestCase {
+
+ /**
+ * Create a new PessimisticTransactionalAccessTestCase.
+ *
+ * @param name
+ */
+ public MvccReplicatedTransactionalTestCase(String name) {
+ super(name);
+ }
+
+ public static Test suite() throws Exception {
+ return getTestSetup(MvccReplicatedTransactionalTestCase.class, "mvcc-shared");
+ }
+
+ @Override
+ public void testCacheConfiguration() {
+ assertFalse("Using Invalidation", isUsingInvalidation());
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ assertTrue("Synchronous mode", isSynchronous());
+ }
+
+ @Override
+ public boolean isBlockingReads() {
+ return false;
+ }
+
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccTransactionalExtraAPITestCase.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccTransactionalExtraAPITestCase.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/MvccTransactionalExtraAPITestCase.java 2008-10-30 18:58:21 UTC (rev 15454)
@@ -0,0 +1,71 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.entity;
+
+import org.hibernate.cache.access.EntityRegionAccessStrategy;
+
+/**
+ * Tests for the "extra API" in EntityRegionAccessStrategy; in this base
+ * version using Optimistic locking with TRANSACTIONAL access.
+ * <p>
+ * By "extra API" we mean those methods that are superfluous to the
+ * function of the JBC integration, where the impl is a no-op or a static
+ * false return value, UnsupportedOperationException, etc.
+ *
+ * @author <a href="brian.stansberry(a)jboss.com">Brian Stansberry</a>
+ * @version $Revision: 1 $
+ */
+public class MvccTransactionalExtraAPITestCase extends OptimisticTransactionalExtraAPITestCase {
+
+ private static EntityRegionAccessStrategy localAccessStrategy;
+
+ /**
+ * Create a new PessimisticAccessStrategyExtraAPITestCase.
+ *
+ * @param name
+ */
+ public MvccTransactionalExtraAPITestCase(String name) {
+ super(name);
+ }
+
+ @Override
+ protected String getCacheConfigName() {
+ return "mvcc-entity";
+ }
+
+ @Override
+ protected EntityRegionAccessStrategy getEntityAccessStrategy() {
+ return localAccessStrategy;
+ }
+
+ @Override
+ protected void setEntityRegionAccessStrategy(EntityRegionAccessStrategy strategy) {
+ localAccessStrategy = strategy;
+ }
+
+ @Override
+ public void testCacheConfiguration() {
+ assertFalse("Using Optimistic locking", isUsingOptimisticLocking());
+ }
+}
16 years, 2 months
Hibernate SVN: r15453 - in core/trunk/envers: src/test/resources and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2008-10-30 12:45:35 -0400 (Thu, 30 Oct 2008)
New Revision: 15453
Added:
core/trunk/envers/src/test/resources/log4j.properties
Modified:
core/trunk/envers/pom.xml
core/trunk/envers/src/test/resources/hibernate.test.cfg.xml
Log:
HHH-3351 : import envers as core module
Modified: core/trunk/envers/pom.xml
===================================================================
--- core/trunk/envers/pom.xml 2008-10-30 12:36:16 UTC (rev 15452)
+++ core/trunk/envers/pom.xml 2008-10-30 16:45:35 UTC (rev 15453)
@@ -1,6 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -94,6 +95,10 @@
<artifactId>javassist</artifactId>
</exclusion>
<exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
<!-- OMG, YUCK YUCK YUCK -->
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
@@ -129,19 +134,21 @@
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.8</version>
+ <classifier>jdk15</classifier>
<scope>test</scope>
- <classifier>jdk15</classifier>
</dependency>
<dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.6</version>
- </dependency>
- <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.0.79</version>
+ <scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.4.GA</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<dependencyManagement>
@@ -189,4 +196,5 @@
<!-- for now, at least, lets aggregate them -->
<jbossenvers.reports.aggregate>true</jbossenvers.reports.aggregate>
</properties>
+
</project>
Modified: core/trunk/envers/src/test/resources/hibernate.test.cfg.xml
===================================================================
--- core/trunk/envers/src/test/resources/hibernate.test.cfg.xml 2008-10-30 12:36:16 UTC (rev 15452)
+++ core/trunk/envers/src/test/resources/hibernate.test.cfg.xml 2008-10-30 16:45:35 UTC (rev 15453)
@@ -8,11 +8,8 @@
<session-factory>
<property name="hbm2ddl.auto">create-drop</property>
- <!--<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
- <property name="connection.url">jdbc:mysql:///hibernate_tests?useUnicode=true&characterEncoding=UTF-8</property>
- <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
- <property name="connection.username">root</property>
- <property name="connection.password"></property>-->
+ <property name="show_sql">false</property>
+ <property name="format_sql">true</property>
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
<property name="connection.url">jdbc:h2:mem:envers</property>
@@ -20,15 +17,6 @@
<property name="connection.username">sa</property>
<property name="connection.password"></property>
- <!--<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
- <property name="connection.url">jdbc:postgresql://localhost/hibernate_tests</property>
- <property name="connection.driver_class">org.postgresql.Driver</property>
- <property name="connection.username">postgres</property>
- <property name="connection.password"></property>-->
-
- <property name="show_sql">false</property>
- <property name="format_sql">true</property>
-
<event type="post-insert">
<listener class="org.hibernate.envers.event.VersionsEventListener" />
</event>
Copied: core/trunk/envers/src/test/resources/log4j.properties (from rev 15426, core/trunk/core/src/test/resources/log4j.properties)
===================================================================
--- core/trunk/envers/src/test/resources/log4j.properties (rev 0)
+++ core/trunk/envers/src/test/resources/log4j.properties 2008-10-30 16:45:35 UTC (rev 15453)
@@ -0,0 +1,32 @@
+#
+# Hibernate, Relational Persistence for Idiomatic Java
+#
+# Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+# indicated by the @author tags or express copyright attribution
+# statements applied by the authors. All third-party contributions are
+# distributed under license by Red Hat Middleware LLC.
+#
+# This copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the GNU
+# Lesser General Public License, as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+# for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this distribution; if not, write to:
+# Free Software Foundation, Inc.
+# 51 Franklin Street, Fifth Floor
+# Boston, MA 02110-1301 USA
+#
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+
+log4j.rootLogger=info, stdout
+
+log4j.logger.org.hibernate.test=info
+log4j.logger.org.hibernate.tool.hbm2ddl=debug
\ No newline at end of file
16 years, 2 months
Hibernate SVN: r15452 - in core/trunk/annotations/src: main/java/org/hibernate/ejb and 5 other directories.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2008-10-30 08:36:16 -0400 (Thu, 30 Oct 2008)
New Revision: 15452
Added:
core/trunk/annotations/src/main/resources/
core/trunk/annotations/src/main/resources/org/
core/trunk/annotations/src/main/resources/org/hibernate/
core/trunk/annotations/src/main/resources/org/hibernate/ejb/
core/trunk/annotations/src/main/resources/org/hibernate/ejb/orm_1_0.xsd
Removed:
core/trunk/annotations/src/main/java/org/hibernate/ejb/orm_1_0.xsd
Modified:
core/trunk/annotations/src/test/resources/hibernate.properties
Log:
* Moved orm_1_0.xsd into the src/main/resources so that it properly get copied at build time
* Enabled query cache in hibernate.properties
Deleted: core/trunk/annotations/src/main/java/org/hibernate/ejb/orm_1_0.xsd
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/ejb/orm_1_0.xsd 2008-10-30 09:05:38 UTC (rev 15451)
+++ core/trunk/annotations/src/main/java/org/hibernate/ejb/orm_1_0.xsd 2008-10-30 12:36:16 UTC (rev 15452)
@@ -1,1540 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Hibernate, Relational Persistence for Idiomatic Java
- ~
- ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- ~ indicated by the @author tags or express copyright attribution
- ~ statements applied by the authors. All third-party contributions are
- ~ distributed under license by Red Hat Middleware LLC.
- ~
- ~ This copyrighted material is made available to anyone wishing to use, modify,
- ~ copy, or redistribute it subject to the terms and conditions of the GNU
- ~ Lesser General Public License, as published by the Free Software Foundation.
- ~
- ~ This program is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- ~ for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public License
- ~ along with this distribution; if not, write to:
- ~ Free Software Foundation, Inc.
- ~ 51 Franklin Street, Fifth Floor
- ~ Boston, MA 02110-1301 USA
- -->
-
-<!-- Java Persistence API object-relational mapping file schema -->
-<xsd:schema targetNamespace="http://java.sun.com/xml/ns/persistence/orm"
- xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified"
- attributeFormDefault="unqualified"
- version="1.0">
-
- <xsd:annotation>
- <xsd:documentation>
- @(#)orm_1_0.xsd 1.0 Feb 14 2006
- </xsd:documentation>
- </xsd:annotation>
- <xsd:annotation>
- <xsd:documentation><![CDATA[
-
- This is the XML Schema for the persistence object-relational
- mapping file.
- The file may be named "META-INF/orm.xml" in the persistence
- archive or it may be named some other name which would be
- used to locate the file as resource on the classpath.
-
- ]]></xsd:documentation>
- </xsd:annotation>
-
- <xsd:complexType name="emptyType"/>
-
- <xsd:simpleType name="versionType">
- <xsd:restriction base="xsd:token">
- <xsd:pattern value="[0-9]+(\.[0-9]+)*"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:element name="entity-mappings">
- <xsd:complexType>
- <xsd:annotation>
- <xsd:documentation>
-
- The entity-mappings element is the root element of an mapping
- file. It contains the following four types of elements:
-
- 1. The persistence-unit-metadata element contains metadata
- for the entire persistence unit. It is undefined if this element
- occurs in multiple mapping files within the same persistence unit.
-
- 2. The package, schema, catalog and access elements apply to all of
- the entity, mapped-superclass and embeddable elements defined in
- the same file in which they occur.
-
- 3. The sequence-generator, table-generator, named-query,
- named-native-query and sql-result-set-mapping elements are global
- to the persistence unit. It is undefined to have more than one
- sequence-generator or table-generator of the same name in the same
- or different mapping files in a persistence unit. It is also
- undefined to have more than one named-query or named-native-query
- of the same name in the same or different mapping files in a
- persistence unit.
-
- 4. The entity, mapped-superclass and embeddable elements each define
- the mapping information for a managed persistent class. The mapping
- information contained in these elements may be complete or it may
- be partial.
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string"
- minOccurs="0"/>
- <xsd:element name="persistence-unit-metadata"
- type="orm:persistence-unit-metadata"
- minOccurs="0"/>
- <xsd:element name="package" type="xsd:string"
- minOccurs="0"/>
- <xsd:element name="schema" type="xsd:string"
- minOccurs="0"/>
- <xsd:element name="catalog" type="xsd:string"
- minOccurs="0"/>
- <xsd:element name="access" type="orm:access-type"
- minOccurs="0"/>
- <xsd:element name="sequence-generator" type="orm:sequence-generator"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="table-generator" type="orm:table-generator"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="named-query" type="orm:named-query"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="named-native-query" type="orm:named-native-query"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="sql-result-set-mapping"
- type="orm:sql-result-set-mapping"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="mapped-superclass" type="orm:mapped-superclass"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="entity" type="orm:entity"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="embeddable" type="orm:embeddable"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="version" type="orm:versionType"
- fixed="1.0" use="required"/>
- </xsd:complexType>
- </xsd:element>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="persistence-unit-metadata">
- <xsd:annotation>
- <xsd:documentation>
-
- Metadata that applies to the persistence unit and not just to
- the mapping file in which it is contained.
-
- If the xml-mapping-metadata-complete element is specified then
- the complete set of mapping metadata for the persistence unit
- is contained in the XML mapping files for the persistence unit.
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="xml-mapping-metadata-complete" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="persistence-unit-defaults"
- type="orm:persistence-unit-defaults"
- minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="persistence-unit-defaults">
- <xsd:annotation>
- <xsd:documentation>
-
- These defaults are applied to the persistence unit as a whole
- unless they are overridden by local annotation or XML
- element settings.
-
- schema - Used as the schema for all tables or secondary tables
- that apply to the persistence unit
- catalog - Used as the catalog for all tables or secondary tables
- that apply to the persistence unit
- access - Used as the access type for all managed classes in
- the persistence unit
- cascade-persist - Adds cascade-persist to the set of cascade options
- in entity relationships of the persistence unit
- entity-listeners - List of default entity listeners to be invoked
- on each entity in the persistence unit.
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="schema" type="xsd:string"
- minOccurs="0"/>
- <xsd:element name="catalog" type="xsd:string"
- minOccurs="0"/>
- <xsd:element name="access" type="orm:access-type"
- minOccurs="0"/>
- <xsd:element name="cascade-persist" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="entity-listeners" type="orm:entity-listeners"
- minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="entity">
- <xsd:annotation>
- <xsd:documentation>
-
- Defines the settings and mappings for an entity. Is allowed to be
- sparsely populated and used in conjunction with the annotations.
- Alternatively, the metadata-complete attribute can be used to
- indicate that no annotations on the entity class (and its fields
- or properties) are to be processed. If this is the case then
- the defaulting rules for the entity and its subelements will
- be recursively applied.
-
- @Target(TYPE) @Retention(RUNTIME)
- public @interface Entity {
- String name() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string" minOccurs="0"/>
- <xsd:element name="table" type="orm:table"
- minOccurs="0"/>
- <xsd:element name="secondary-table" type="orm:secondary-table"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="primary-key-join-column"
- type="orm:primary-key-join-column"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="id-class" type="orm:id-class" minOccurs="0"/>
- <xsd:element name="inheritance" type="orm:inheritance" minOccurs="0"/>
- <xsd:element name="discriminator-value" type="orm:discriminator-value"
- minOccurs="0"/>
- <xsd:element name="discriminator-column"
- type="orm:discriminator-column"
- minOccurs="0"/>
- <xsd:element name="sequence-generator" type="orm:sequence-generator"
- minOccurs="0"/>
- <xsd:element name="table-generator" type="orm:table-generator"
- minOccurs="0"/>
- <xsd:element name="named-query" type="orm:named-query"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="named-native-query" type="orm:named-native-query"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="sql-result-set-mapping"
- type="orm:sql-result-set-mapping"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="exclude-default-listeners" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="exclude-superclass-listeners" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="entity-listeners" type="orm:entity-listeners"
- minOccurs="0"/>
- <xsd:element name="pre-persist" type="orm:pre-persist" minOccurs="0"/>
- <xsd:element name="post-persist" type="orm:post-persist"
- minOccurs="0"/>
- <xsd:element name="pre-remove" type="orm:pre-remove" minOccurs="0"/>
- <xsd:element name="post-remove" type="orm:post-remove" minOccurs="0"/>
- <xsd:element name="pre-update" type="orm:pre-update" minOccurs="0"/>
- <xsd:element name="post-update" type="orm:post-update" minOccurs="0"/>
- <xsd:element name="post-load" type="orm:post-load" minOccurs="0"/>
- <xsd:element name="attribute-override" type="orm:attribute-override"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="association-override"
- type="orm:association-override"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="attributes" type="orm:attributes" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string"/>
- <xsd:attribute name="class" type="xsd:string" use="required"/>
- <xsd:attribute name="access" type="orm:access-type"/>
- <xsd:attribute name="metadata-complete" type="xsd:boolean"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="attributes">
- <xsd:annotation>
- <xsd:documentation>
-
- This element contains the entity field or property mappings.
- It may be sparsely populated to include only a subset of the
- fields or properties. If metadata-complete for the entity is true
- then the remainder of the attributes will be defaulted according
- to the default rules.
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:choice>
- <xsd:element name="id" type="orm:id"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="embedded-id" type="orm:embedded-id"
- minOccurs="0"/>
- </xsd:choice>
- <xsd:element name="basic" type="orm:basic"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="version" type="orm:version"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="many-to-one" type="orm:many-to-one"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="one-to-many" type="orm:one-to-many"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="one-to-one" type="orm:one-to-one"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="many-to-many" type="orm:many-to-many"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="embedded" type="orm:embedded"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="transient" type="orm:transient"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="access-type">
- <xsd:annotation>
- <xsd:documentation>
-
- This element determines how the persistence provider accesses the
- state of an entity or embedded object.
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="PROPERTY"/>
- <xsd:enumeration value="FIELD"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="entity-listeners">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface EntityListeners {
- Class[] value();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="entity-listener" type="orm:entity-listener"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="entity-listener">
- <xsd:annotation>
- <xsd:documentation>
-
- Defines an entity listener to be invoked at lifecycle events
- for the entities that list this listener.
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="pre-persist" type="orm:pre-persist" minOccurs="0"/>
- <xsd:element name="post-persist" type="orm:post-persist"
- minOccurs="0"/>
- <xsd:element name="pre-remove" type="orm:pre-remove" minOccurs="0"/>
- <xsd:element name="post-remove" type="orm:post-remove" minOccurs="0"/>
- <xsd:element name="pre-update" type="orm:pre-update" minOccurs="0"/>
- <xsd:element name="post-update" type="orm:post-update" minOccurs="0"/>
- <xsd:element name="post-load" type="orm:post-load" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="class" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="pre-persist">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD}) @Retention(RUNTIME)
- public @interface PrePersist {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="method-name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="post-persist">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD}) @Retention(RUNTIME)
- public @interface PostPersist {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="method-name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="pre-remove">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD}) @Retention(RUNTIME)
- public @interface PreRemove {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="method-name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="post-remove">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD}) @Retention(RUNTIME)
- public @interface PostRemove {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="method-name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="pre-update">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD}) @Retention(RUNTIME)
- public @interface PreUpdate {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="method-name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="post-update">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD}) @Retention(RUNTIME)
- public @interface PostUpdate {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="method-name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="post-load">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD}) @Retention(RUNTIME)
- public @interface PostLoad {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="method-name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="query-hint">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({}) @Retention(RUNTIME)
- public @interface QueryHint {
- String name();
- String value();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="value" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="named-query">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface NamedQuery {
- String name();
- String query();
- QueryHint[] hints() default {};
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="query" type="xsd:string"/>
- <xsd:element name="hint" type="orm:query-hint"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="named-native-query">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface NamedNativeQuery {
- String name();
- String query();
- QueryHint[] hints() default {};
- Class resultClass() default void.class;
- String resultSetMapping() default ""; //named SqlResultSetMapping
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="query" type="xsd:string"/>
- <xsd:element name="hint" type="orm:query-hint"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="result-class" type="xsd:string"/>
- <xsd:attribute name="result-set-mapping" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="sql-result-set-mapping">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface SqlResultSetMapping {
- String name();
- EntityResult[] entities() default {};
- ColumnResult[] columns() default {};
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="entity-result" type="orm:entity-result"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="column-result" type="orm:column-result"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="entity-result">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({}) @Retention(RUNTIME)
- public @interface EntityResult {
- Class entityClass();
- FieldResult[] fields() default {};
- String discriminatorColumn() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="field-result" type="orm:field-result"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="entity-class" type="xsd:string" use="required"/>
- <xsd:attribute name="discriminator-column" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="field-result">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({}) @Retention(RUNTIME)
- public @interface FieldResult {
- String name();
- String column();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="column" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="column-result">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({}) @Retention(RUNTIME)
- public @interface ColumnResult {
- String name();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="table">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface Table {
- String name() default "";
- String catalog() default "";
- String schema() default "";
- UniqueConstraint[] uniqueConstraints() default {};
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="unique-constraint" type="orm:unique-constraint"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string"/>
- <xsd:attribute name="catalog" type="xsd:string"/>
- <xsd:attribute name="schema" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="secondary-table">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface SecondaryTable {
- String name();
- String catalog() default "";
- String schema() default "";
- PrimaryKeyJoinColumn[] pkJoinColumns() default {};
- UniqueConstraint[] uniqueConstraints() default {};
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="primary-key-join-column"
- type="orm:primary-key-join-column"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="unique-constraint" type="orm:unique-constraint"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="catalog" type="xsd:string"/>
- <xsd:attribute name="schema" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="unique-constraint">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({}) @Retention(RUNTIME)
- public @interface UniqueConstraint {
- String[] columnNames();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="column-name" type="xsd:string"
- maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="column">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Column {
- String name() default "";
- boolean unique() default false;
- boolean nullable() default true;
- boolean insertable() default true;
- boolean updatable() default true;
- String columnDefinition() default "";
- String table() default "";
- int length() default 255;
- int precision() default 0; // decimal precision
- int scale() default 0; // decimal scale
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string"/>
- <xsd:attribute name="unique" type="xsd:boolean"/>
- <xsd:attribute name="nullable" type="xsd:boolean"/>
- <xsd:attribute name="insertable" type="xsd:boolean"/>
- <xsd:attribute name="updatable" type="xsd:boolean"/>
- <xsd:attribute name="column-definition" type="xsd:string"/>
- <xsd:attribute name="table" type="xsd:string"/>
- <xsd:attribute name="length" type="xsd:int"/>
- <xsd:attribute name="precision" type="xsd:int"/>
- <xsd:attribute name="scale" type="xsd:int"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="join-column">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface JoinColumn {
- String name() default "";
- String referencedColumnName() default "";
- boolean unique() default false;
- boolean nullable() default true;
- boolean insertable() default true;
- boolean updatable() default true;
- String columnDefinition() default "";
- String table() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string"/>
- <xsd:attribute name="referenced-column-name" type="xsd:string"/>
- <xsd:attribute name="unique" type="xsd:boolean"/>
- <xsd:attribute name="nullable" type="xsd:boolean"/>
- <xsd:attribute name="insertable" type="xsd:boolean"/>
- <xsd:attribute name="updatable" type="xsd:boolean"/>
- <xsd:attribute name="column-definition" type="xsd:string"/>
- <xsd:attribute name="table" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="generation-type">
- <xsd:annotation>
- <xsd:documentation>
-
- public enum GenerationType { TABLE, SEQUENCE, IDENTITY, AUTO };
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="TABLE"/>
- <xsd:enumeration value="SEQUENCE"/>
- <xsd:enumeration value="IDENTITY"/>
- <xsd:enumeration value="AUTO"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="attribute-override">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
- public @interface AttributeOverride {
- String name();
- Column column();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="column" type="orm:column"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="association-override">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
- public @interface AssociationOverride {
- String name();
- JoinColumn[] joinColumns();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="join-column" type="orm:join-column"
- maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="id-class">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface IdClass {
- Class value();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="class" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="id">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Id {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="column" type="orm:column"
- minOccurs="0"/>
- <xsd:element name="generated-value" type="orm:generated-value"
- minOccurs="0"/>
- <xsd:element name="temporal" type="orm:temporal"
- minOccurs="0"/>
- <xsd:element name="table-generator" type="orm:table-generator"
- minOccurs="0"/>
- <xsd:element name="sequence-generator" type="orm:sequence-generator"
- minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="embedded-id">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface EmbeddedId {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="attribute-override" type="orm:attribute-override"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="transient">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Transient {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="version">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Version {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="column" type="orm:column" minOccurs="0"/>
- <xsd:element name="temporal" type="orm:temporal" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="basic">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Basic {
- FetchType fetch() default EAGER;
- boolean optional() default true;
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="column" type="orm:column" minOccurs="0"/>
- <xsd:choice>
- <xsd:element name="lob" type="orm:lob" minOccurs="0"/>
- <xsd:element name="temporal" type="orm:temporal" minOccurs="0"/>
- <xsd:element name="enumerated" type="orm:enumerated" minOccurs="0"/>
- </xsd:choice>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="fetch" type="orm:fetch-type"/>
- <xsd:attribute name="optional" type="xsd:boolean"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="fetch-type">
- <xsd:annotation>
- <xsd:documentation>
-
- public enum FetchType { LAZY, EAGER };
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="LAZY"/>
- <xsd:enumeration value="EAGER"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="lob">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Lob {}
-
- </xsd:documentation>
- </xsd:annotation>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="temporal">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Temporal {
- TemporalType value();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="orm:temporal-type"/>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="temporal-type">
- <xsd:annotation>
- <xsd:documentation>
-
- public enum TemporalType {
- DATE, // java.sql.Date
- TIME, // java.sql.Time
- TIMESTAMP // java.sql.Timestamp
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="DATE"/>
- <xsd:enumeration value="TIME"/>
- <xsd:enumeration value="TIMESTAMP"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="enumerated">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Enumerated {
- EnumType value() default ORDINAL;
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="orm:enum-type"/>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="enum-type">
- <xsd:annotation>
- <xsd:documentation>
-
- public enum EnumType {
- ORDINAL,
- STRING
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="ORDINAL"/>
- <xsd:enumeration value="STRING"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="many-to-one">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface ManyToOne {
- Class targetEntity() default void.class;
- CascadeType[] cascade() default {};
- FetchType fetch() default EAGER;
- boolean optional() default true;
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:choice>
- <xsd:element name="join-column" type="orm:join-column"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="join-table" type="orm:join-table"
- minOccurs="0"/>
- </xsd:choice>
- <xsd:element name="cascade" type="orm:cascade-type"
- minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="target-entity" type="xsd:string"/>
- <xsd:attribute name="fetch" type="orm:fetch-type"/>
- <xsd:attribute name="optional" type="xsd:boolean"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="cascade-type">
- <xsd:annotation>
- <xsd:documentation>
-
- public enum CascadeType { ALL, PERSIST, MERGE, REMOVE, REFRESH};
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="cascade-all" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="cascade-persist" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="cascade-merge" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="cascade-remove" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="cascade-refresh" type="orm:emptyType"
- minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="one-to-one">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface OneToOne {
- Class targetEntity() default void.class;
- CascadeType[] cascade() default {};
- FetchType fetch() default EAGER;
- boolean optional() default true;
- String mappedBy() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:choice>
- <xsd:element name="primary-key-join-column"
- type="orm:primary-key-join-column"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="join-column" type="orm:join-column"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="join-table" type="orm:join-table"
- minOccurs="0"/>
- </xsd:choice>
- <xsd:element name="cascade" type="orm:cascade-type"
- minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="target-entity" type="xsd:string"/>
- <xsd:attribute name="fetch" type="orm:fetch-type"/>
- <xsd:attribute name="optional" type="xsd:boolean"/>
- <xsd:attribute name="mapped-by" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="one-to-many">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface OneToMany {
- Class targetEntity() default void.class;
- CascadeType[] cascade() default {};
- FetchType fetch() default LAZY;
- String mappedBy() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="order-by" type="orm:order-by"
- minOccurs="0"/>
- <xsd:element name="map-key" type="orm:map-key"
- minOccurs="0"/>
- <xsd:choice>
- <xsd:element name="join-table" type="orm:join-table"
- minOccurs="0"/>
- <xsd:element name="join-column" type="orm:join-column"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:choice>
- <xsd:element name="cascade" type="orm:cascade-type"
- minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="target-entity" type="xsd:string"/>
- <xsd:attribute name="fetch" type="orm:fetch-type"/>
- <xsd:attribute name="mapped-by" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="join-table">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface JoinTable {
- String name() default "";
- String catalog() default "";
- String schema() default "";
- JoinColumn[] joinColumns() default {};
- JoinColumn[] inverseJoinColumns() default {};
- UniqueConstraint[] uniqueConstraints() default {};
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="join-column" type="orm:join-column"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="inverse-join-column" type="orm:join-column"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="unique-constraint" type="orm:unique-constraint"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string"/>
- <xsd:attribute name="catalog" type="xsd:string"/>
- <xsd:attribute name="schema" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="many-to-many">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface ManyToMany {
- Class targetEntity() default void.class;
- CascadeType[] cascade() default {};
- FetchType fetch() default LAZY;
- String mappedBy() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="order-by" type="orm:order-by"
- minOccurs="0"/>
- <xsd:element name="map-key" type="orm:map-key"
- minOccurs="0"/>
- <xsd:element name="join-table" type="orm:join-table"
- minOccurs="0"/>
- <xsd:element name="cascade" type="orm:cascade-type"
- minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="target-entity" type="xsd:string"/>
- <xsd:attribute name="fetch" type="orm:fetch-type"/>
- <xsd:attribute name="mapped-by" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="generated-value">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface GeneratedValue {
- GenerationType strategy() default AUTO;
- String generator() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="strategy" type="orm:generation-type"/>
- <xsd:attribute name="generator" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="map-key">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface MapKey {
- String name() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="order-by">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface OrderBy {
- String value() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="inheritance">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface Inheritance {
- InheritanceType strategy() default SINGLE_TABLE;
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="strategy" type="orm:inheritance-type"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="inheritance-type">
- <xsd:annotation>
- <xsd:documentation>
-
- public enum InheritanceType
- { SINGLE_TABLE, JOINED, TABLE_PER_CLASS};
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="SINGLE_TABLE"/>
- <xsd:enumeration value="JOINED"/>
- <xsd:enumeration value="TABLE_PER_CLASS"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="discriminator-value">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface DiscriminatorValue {
- String value();
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:string"/>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:simpleType name="discriminator-type">
- <xsd:annotation>
- <xsd:documentation>
-
- public enum DiscriminatorType { STRING, CHAR, INTEGER };
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="STRING"/>
- <xsd:enumeration value="CHAR"/>
- <xsd:enumeration value="INTEGER"/>
- </xsd:restriction>
- </xsd:simpleType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="primary-key-join-column">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
- public @interface PrimaryKeyJoinColumn {
- String name() default "";
- String referencedColumnName() default "";
- String columnDefinition() default "";
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string"/>
- <xsd:attribute name="referenced-column-name" type="xsd:string"/>
- <xsd:attribute name="column-definition" type="xsd:string"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="discriminator-column">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface DiscriminatorColumn {
- String name() default "DTYPE";
- DiscriminatorType discriminatorType() default STRING;
- String columnDefinition() default "";
- int length() default 31;
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string"/>
- <xsd:attribute name="discriminator-type" type="orm:discriminator-type"/>
- <xsd:attribute name="column-definition" type="xsd:string"/>
- <xsd:attribute name="length" type="xsd:int"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="embeddable">
- <xsd:annotation>
- <xsd:documentation>
-
- Defines the settings and mappings for embeddable objects. Is
- allowed to be sparsely populated and used in conjunction with
- the annotations. Alternatively, the metadata-complete attribute
- can be used to indicate that no annotations are to be processed
- in the class. If this is the case then the defaulting rules will
- be recursively applied.
-
- @Target({TYPE}) @Retention(RUNTIME)
- public @interface Embeddable {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string" minOccurs="0"/>
- <xsd:element name="attributes" type="orm:embeddable-attributes"
- minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="class" type="xsd:string" use="required"/>
- <xsd:attribute name="access" type="orm:access-type"/>
- <xsd:attribute name="metadata-complete" type="xsd:boolean"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="embeddable-attributes">
- <xsd:sequence>
- <xsd:element name="basic" type="orm:basic"
- minOccurs="0" maxOccurs="unbounded"/>
- <xsd:element name="transient" type="orm:transient"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="embedded">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({METHOD, FIELD}) @Retention(RUNTIME)
- public @interface Embedded {}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="attribute-override" type="orm:attribute-override"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="mapped-superclass">
- <xsd:annotation>
- <xsd:documentation>
-
- Defines the settings and mappings for a mapped superclass. Is
- allowed to be sparsely populated and used in conjunction with
- the annotations. Alternatively, the metadata-complete attribute
- can be used to indicate that no annotations are to be processed
- If this is the case then the defaulting rules will be recursively
- applied.
-
- @Target(TYPE) @Retention(RUNTIME)
- public @interface MappedSuperclass{}
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="description" type="xsd:string" minOccurs="0"/>
- <xsd:element name="id-class" type="orm:id-class" minOccurs="0"/>
- <xsd:element name="exclude-default-listeners" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="exclude-superclass-listeners" type="orm:emptyType"
- minOccurs="0"/>
- <xsd:element name="entity-listeners" type="orm:entity-listeners"
- minOccurs="0"/>
- <xsd:element name="pre-persist" type="orm:pre-persist" minOccurs="0"/>
- <xsd:element name="post-persist" type="orm:post-persist"
- minOccurs="0"/>
- <xsd:element name="pre-remove" type="orm:pre-remove" minOccurs="0"/>
- <xsd:element name="post-remove" type="orm:post-remove" minOccurs="0"/>
- <xsd:element name="pre-update" type="orm:pre-update" minOccurs="0"/>
- <xsd:element name="post-update" type="orm:post-update" minOccurs="0"/>
- <xsd:element name="post-load" type="orm:post-load" minOccurs="0"/>
- <xsd:element name="attributes" type="orm:attributes" minOccurs="0"/>
- </xsd:sequence>
- <xsd:attribute name="class" type="xsd:string" use="required"/>
- <xsd:attribute name="access" type="orm:access-type"/>
- <xsd:attribute name="metadata-complete" type="xsd:boolean"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="sequence-generator">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
- public @interface SequenceGenerator {
- String name();
- String sequenceName() default "";
- int initialValue() default 1;
- int allocationSize() default 50;
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="sequence-name" type="xsd:string"/>
- <xsd:attribute name="initial-value" type="xsd:int"/>
- <xsd:attribute name="allocation-size" type="xsd:int"/>
- </xsd:complexType>
-
- <!-- **************************************************** -->
-
- <xsd:complexType name="table-generator">
- <xsd:annotation>
- <xsd:documentation>
-
- @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
- public @interface TableGenerator {
- String name();
- String table() default "";
- String catalog() default "";
- String schema() default "";
- String pkColumnName() default "";
- String valueColumnName() default "";
- String pkColumnValue() default "";
- int initialValue() default 0;
- int allocationSize() default 50;
- UniqueConstraint[] uniqueConstraints() default {};
- }
-
- </xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="unique-constraint" type="orm:unique-constraint"
- minOccurs="0" maxOccurs="unbounded"/>
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required"/>
- <xsd:attribute name="table" type="xsd:string"/>
- <xsd:attribute name="catalog" type="xsd:string"/>
- <xsd:attribute name="schema" type="xsd:string"/>
- <xsd:attribute name="pk-column-name" type="xsd:string"/>
- <xsd:attribute name="value-column-name" type="xsd:string"/>
- <xsd:attribute name="pk-column-value" type="xsd:string"/>
- <xsd:attribute name="initial-value" type="xsd:int"/>
- <xsd:attribute name="allocation-size" type="xsd:int"/>
- </xsd:complexType>
-
-</xsd:schema>
-
-
Copied: core/trunk/annotations/src/main/resources/org/hibernate/ejb/orm_1_0.xsd (from rev 15436, core/trunk/annotations/src/main/java/org/hibernate/ejb/orm_1_0.xsd)
===================================================================
--- core/trunk/annotations/src/main/resources/org/hibernate/ejb/orm_1_0.xsd (rev 0)
+++ core/trunk/annotations/src/main/resources/org/hibernate/ejb/orm_1_0.xsd 2008-10-30 12:36:16 UTC (rev 15452)
@@ -0,0 +1,1540 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+
+<!-- Java Persistence API object-relational mapping file schema -->
+<xsd:schema targetNamespace="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0">
+
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)orm_1_0.xsd 1.0 Feb 14 2006
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+
+ This is the XML Schema for the persistence object-relational
+ mapping file.
+ The file may be named "META-INF/orm.xml" in the persistence
+ archive or it may be named some other name which would be
+ used to locate the file as resource on the classpath.
+
+ ]]></xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:complexType name="emptyType"/>
+
+ <xsd:simpleType name="versionType">
+ <xsd:restriction base="xsd:token">
+ <xsd:pattern value="[0-9]+(\.[0-9]+)*"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:element name="entity-mappings">
+ <xsd:complexType>
+ <xsd:annotation>
+ <xsd:documentation>
+
+ The entity-mappings element is the root element of an mapping
+ file. It contains the following four types of elements:
+
+ 1. The persistence-unit-metadata element contains metadata
+ for the entire persistence unit. It is undefined if this element
+ occurs in multiple mapping files within the same persistence unit.
+
+ 2. The package, schema, catalog and access elements apply to all of
+ the entity, mapped-superclass and embeddable elements defined in
+ the same file in which they occur.
+
+ 3. The sequence-generator, table-generator, named-query,
+ named-native-query and sql-result-set-mapping elements are global
+ to the persistence unit. It is undefined to have more than one
+ sequence-generator or table-generator of the same name in the same
+ or different mapping files in a persistence unit. It is also
+ undefined to have more than one named-query or named-native-query
+ of the same name in the same or different mapping files in a
+ persistence unit.
+
+ 4. The entity, mapped-superclass and embeddable elements each define
+ the mapping information for a managed persistent class. The mapping
+ information contained in these elements may be complete or it may
+ be partial.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string"
+ minOccurs="0"/>
+ <xsd:element name="persistence-unit-metadata"
+ type="orm:persistence-unit-metadata"
+ minOccurs="0"/>
+ <xsd:element name="package" type="xsd:string"
+ minOccurs="0"/>
+ <xsd:element name="schema" type="xsd:string"
+ minOccurs="0"/>
+ <xsd:element name="catalog" type="xsd:string"
+ minOccurs="0"/>
+ <xsd:element name="access" type="orm:access-type"
+ minOccurs="0"/>
+ <xsd:element name="sequence-generator" type="orm:sequence-generator"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="table-generator" type="orm:table-generator"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="named-query" type="orm:named-query"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="named-native-query" type="orm:named-native-query"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="sql-result-set-mapping"
+ type="orm:sql-result-set-mapping"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="mapped-superclass" type="orm:mapped-superclass"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="entity" type="orm:entity"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="embeddable" type="orm:embeddable"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="version" type="orm:versionType"
+ fixed="1.0" use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-unit-metadata">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Metadata that applies to the persistence unit and not just to
+ the mapping file in which it is contained.
+
+ If the xml-mapping-metadata-complete element is specified then
+ the complete set of mapping metadata for the persistence unit
+ is contained in the XML mapping files for the persistence unit.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="xml-mapping-metadata-complete" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="persistence-unit-defaults"
+ type="orm:persistence-unit-defaults"
+ minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="persistence-unit-defaults">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ These defaults are applied to the persistence unit as a whole
+ unless they are overridden by local annotation or XML
+ element settings.
+
+ schema - Used as the schema for all tables or secondary tables
+ that apply to the persistence unit
+ catalog - Used as the catalog for all tables or secondary tables
+ that apply to the persistence unit
+ access - Used as the access type for all managed classes in
+ the persistence unit
+ cascade-persist - Adds cascade-persist to the set of cascade options
+ in entity relationships of the persistence unit
+ entity-listeners - List of default entity listeners to be invoked
+ on each entity in the persistence unit.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="schema" type="xsd:string"
+ minOccurs="0"/>
+ <xsd:element name="catalog" type="xsd:string"
+ minOccurs="0"/>
+ <xsd:element name="access" type="orm:access-type"
+ minOccurs="0"/>
+ <xsd:element name="cascade-persist" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="entity-listeners" type="orm:entity-listeners"
+ minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="entity">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the settings and mappings for an entity. Is allowed to be
+ sparsely populated and used in conjunction with the annotations.
+ Alternatively, the metadata-complete attribute can be used to
+ indicate that no annotations on the entity class (and its fields
+ or properties) are to be processed. If this is the case then
+ the defaulting rules for the entity and its subelements will
+ be recursively applied.
+
+ @Target(TYPE) @Retention(RUNTIME)
+ public @interface Entity {
+ String name() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="table" type="orm:table"
+ minOccurs="0"/>
+ <xsd:element name="secondary-table" type="orm:secondary-table"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="primary-key-join-column"
+ type="orm:primary-key-join-column"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="id-class" type="orm:id-class" minOccurs="0"/>
+ <xsd:element name="inheritance" type="orm:inheritance" minOccurs="0"/>
+ <xsd:element name="discriminator-value" type="orm:discriminator-value"
+ minOccurs="0"/>
+ <xsd:element name="discriminator-column"
+ type="orm:discriminator-column"
+ minOccurs="0"/>
+ <xsd:element name="sequence-generator" type="orm:sequence-generator"
+ minOccurs="0"/>
+ <xsd:element name="table-generator" type="orm:table-generator"
+ minOccurs="0"/>
+ <xsd:element name="named-query" type="orm:named-query"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="named-native-query" type="orm:named-native-query"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="sql-result-set-mapping"
+ type="orm:sql-result-set-mapping"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="exclude-default-listeners" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="exclude-superclass-listeners" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="entity-listeners" type="orm:entity-listeners"
+ minOccurs="0"/>
+ <xsd:element name="pre-persist" type="orm:pre-persist" minOccurs="0"/>
+ <xsd:element name="post-persist" type="orm:post-persist"
+ minOccurs="0"/>
+ <xsd:element name="pre-remove" type="orm:pre-remove" minOccurs="0"/>
+ <xsd:element name="post-remove" type="orm:post-remove" minOccurs="0"/>
+ <xsd:element name="pre-update" type="orm:pre-update" minOccurs="0"/>
+ <xsd:element name="post-update" type="orm:post-update" minOccurs="0"/>
+ <xsd:element name="post-load" type="orm:post-load" minOccurs="0"/>
+ <xsd:element name="attribute-override" type="orm:attribute-override"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="association-override"
+ type="orm:association-override"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="attributes" type="orm:attributes" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="class" type="xsd:string" use="required"/>
+ <xsd:attribute name="access" type="orm:access-type"/>
+ <xsd:attribute name="metadata-complete" type="xsd:boolean"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="attributes">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This element contains the entity field or property mappings.
+ It may be sparsely populated to include only a subset of the
+ fields or properties. If metadata-complete for the entity is true
+ then the remainder of the attributes will be defaulted according
+ to the default rules.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element name="id" type="orm:id"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="embedded-id" type="orm:embedded-id"
+ minOccurs="0"/>
+ </xsd:choice>
+ <xsd:element name="basic" type="orm:basic"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="version" type="orm:version"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="many-to-one" type="orm:many-to-one"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="one-to-many" type="orm:one-to-many"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="one-to-one" type="orm:one-to-one"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="many-to-many" type="orm:many-to-many"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="embedded" type="orm:embedded"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="transient" type="orm:transient"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="access-type">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ This element determines how the persistence provider accesses the
+ state of an entity or embedded object.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="PROPERTY"/>
+ <xsd:enumeration value="FIELD"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="entity-listeners">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface EntityListeners {
+ Class[] value();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="entity-listener" type="orm:entity-listener"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="entity-listener">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines an entity listener to be invoked at lifecycle events
+ for the entities that list this listener.
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="pre-persist" type="orm:pre-persist" minOccurs="0"/>
+ <xsd:element name="post-persist" type="orm:post-persist"
+ minOccurs="0"/>
+ <xsd:element name="pre-remove" type="orm:pre-remove" minOccurs="0"/>
+ <xsd:element name="post-remove" type="orm:post-remove" minOccurs="0"/>
+ <xsd:element name="pre-update" type="orm:pre-update" minOccurs="0"/>
+ <xsd:element name="post-update" type="orm:post-update" minOccurs="0"/>
+ <xsd:element name="post-load" type="orm:post-load" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="class" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="pre-persist">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD}) @Retention(RUNTIME)
+ public @interface PrePersist {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="method-name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="post-persist">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD}) @Retention(RUNTIME)
+ public @interface PostPersist {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="method-name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="pre-remove">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD}) @Retention(RUNTIME)
+ public @interface PreRemove {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="method-name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="post-remove">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD}) @Retention(RUNTIME)
+ public @interface PostRemove {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="method-name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="pre-update">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD}) @Retention(RUNTIME)
+ public @interface PreUpdate {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="method-name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="post-update">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD}) @Retention(RUNTIME)
+ public @interface PostUpdate {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="method-name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="post-load">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD}) @Retention(RUNTIME)
+ public @interface PostLoad {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="method-name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="query-hint">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({}) @Retention(RUNTIME)
+ public @interface QueryHint {
+ String name();
+ String value();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="value" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="named-query">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface NamedQuery {
+ String name();
+ String query();
+ QueryHint[] hints() default {};
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="query" type="xsd:string"/>
+ <xsd:element name="hint" type="orm:query-hint"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="named-native-query">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface NamedNativeQuery {
+ String name();
+ String query();
+ QueryHint[] hints() default {};
+ Class resultClass() default void.class;
+ String resultSetMapping() default ""; //named SqlResultSetMapping
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="query" type="xsd:string"/>
+ <xsd:element name="hint" type="orm:query-hint"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="result-class" type="xsd:string"/>
+ <xsd:attribute name="result-set-mapping" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="sql-result-set-mapping">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface SqlResultSetMapping {
+ String name();
+ EntityResult[] entities() default {};
+ ColumnResult[] columns() default {};
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="entity-result" type="orm:entity-result"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="column-result" type="orm:column-result"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="entity-result">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({}) @Retention(RUNTIME)
+ public @interface EntityResult {
+ Class entityClass();
+ FieldResult[] fields() default {};
+ String discriminatorColumn() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="field-result" type="orm:field-result"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="entity-class" type="xsd:string" use="required"/>
+ <xsd:attribute name="discriminator-column" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="field-result">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({}) @Retention(RUNTIME)
+ public @interface FieldResult {
+ String name();
+ String column();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="column" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="column-result">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({}) @Retention(RUNTIME)
+ public @interface ColumnResult {
+ String name();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="table">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface Table {
+ String name() default "";
+ String catalog() default "";
+ String schema() default "";
+ UniqueConstraint[] uniqueConstraints() default {};
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="unique-constraint" type="orm:unique-constraint"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="catalog" type="xsd:string"/>
+ <xsd:attribute name="schema" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="secondary-table">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface SecondaryTable {
+ String name();
+ String catalog() default "";
+ String schema() default "";
+ PrimaryKeyJoinColumn[] pkJoinColumns() default {};
+ UniqueConstraint[] uniqueConstraints() default {};
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="primary-key-join-column"
+ type="orm:primary-key-join-column"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="unique-constraint" type="orm:unique-constraint"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="catalog" type="xsd:string"/>
+ <xsd:attribute name="schema" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="unique-constraint">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({}) @Retention(RUNTIME)
+ public @interface UniqueConstraint {
+ String[] columnNames();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="column-name" type="xsd:string"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="column">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Column {
+ String name() default "";
+ boolean unique() default false;
+ boolean nullable() default true;
+ boolean insertable() default true;
+ boolean updatable() default true;
+ String columnDefinition() default "";
+ String table() default "";
+ int length() default 255;
+ int precision() default 0; // decimal precision
+ int scale() default 0; // decimal scale
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="unique" type="xsd:boolean"/>
+ <xsd:attribute name="nullable" type="xsd:boolean"/>
+ <xsd:attribute name="insertable" type="xsd:boolean"/>
+ <xsd:attribute name="updatable" type="xsd:boolean"/>
+ <xsd:attribute name="column-definition" type="xsd:string"/>
+ <xsd:attribute name="table" type="xsd:string"/>
+ <xsd:attribute name="length" type="xsd:int"/>
+ <xsd:attribute name="precision" type="xsd:int"/>
+ <xsd:attribute name="scale" type="xsd:int"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="join-column">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface JoinColumn {
+ String name() default "";
+ String referencedColumnName() default "";
+ boolean unique() default false;
+ boolean nullable() default true;
+ boolean insertable() default true;
+ boolean updatable() default true;
+ String columnDefinition() default "";
+ String table() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="referenced-column-name" type="xsd:string"/>
+ <xsd:attribute name="unique" type="xsd:boolean"/>
+ <xsd:attribute name="nullable" type="xsd:boolean"/>
+ <xsd:attribute name="insertable" type="xsd:boolean"/>
+ <xsd:attribute name="updatable" type="xsd:boolean"/>
+ <xsd:attribute name="column-definition" type="xsd:string"/>
+ <xsd:attribute name="table" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="generation-type">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ public enum GenerationType { TABLE, SEQUENCE, IDENTITY, AUTO };
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="TABLE"/>
+ <xsd:enumeration value="SEQUENCE"/>
+ <xsd:enumeration value="IDENTITY"/>
+ <xsd:enumeration value="AUTO"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="attribute-override">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface AttributeOverride {
+ String name();
+ Column column();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="column" type="orm:column"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="association-override">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface AssociationOverride {
+ String name();
+ JoinColumn[] joinColumns();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="join-column" type="orm:join-column"
+ maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="id-class">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface IdClass {
+ Class value();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="class" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="id">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Id {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="column" type="orm:column"
+ minOccurs="0"/>
+ <xsd:element name="generated-value" type="orm:generated-value"
+ minOccurs="0"/>
+ <xsd:element name="temporal" type="orm:temporal"
+ minOccurs="0"/>
+ <xsd:element name="table-generator" type="orm:table-generator"
+ minOccurs="0"/>
+ <xsd:element name="sequence-generator" type="orm:sequence-generator"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="embedded-id">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface EmbeddedId {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="attribute-override" type="orm:attribute-override"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="transient">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Transient {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="version">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Version {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="column" type="orm:column" minOccurs="0"/>
+ <xsd:element name="temporal" type="orm:temporal" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="basic">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Basic {
+ FetchType fetch() default EAGER;
+ boolean optional() default true;
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="column" type="orm:column" minOccurs="0"/>
+ <xsd:choice>
+ <xsd:element name="lob" type="orm:lob" minOccurs="0"/>
+ <xsd:element name="temporal" type="orm:temporal" minOccurs="0"/>
+ <xsd:element name="enumerated" type="orm:enumerated" minOccurs="0"/>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="fetch" type="orm:fetch-type"/>
+ <xsd:attribute name="optional" type="xsd:boolean"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="fetch-type">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ public enum FetchType { LAZY, EAGER };
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="LAZY"/>
+ <xsd:enumeration value="EAGER"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="lob">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Lob {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="temporal">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Temporal {
+ TemporalType value();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="orm:temporal-type"/>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="temporal-type">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ public enum TemporalType {
+ DATE, // java.sql.Date
+ TIME, // java.sql.Time
+ TIMESTAMP // java.sql.Timestamp
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="DATE"/>
+ <xsd:enumeration value="TIME"/>
+ <xsd:enumeration value="TIMESTAMP"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="enumerated">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Enumerated {
+ EnumType value() default ORDINAL;
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="orm:enum-type"/>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="enum-type">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ public enum EnumType {
+ ORDINAL,
+ STRING
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="ORDINAL"/>
+ <xsd:enumeration value="STRING"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="many-to-one">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface ManyToOne {
+ Class targetEntity() default void.class;
+ CascadeType[] cascade() default {};
+ FetchType fetch() default EAGER;
+ boolean optional() default true;
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element name="join-column" type="orm:join-column"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="join-table" type="orm:join-table"
+ minOccurs="0"/>
+ </xsd:choice>
+ <xsd:element name="cascade" type="orm:cascade-type"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="target-entity" type="xsd:string"/>
+ <xsd:attribute name="fetch" type="orm:fetch-type"/>
+ <xsd:attribute name="optional" type="xsd:boolean"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="cascade-type">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ public enum CascadeType { ALL, PERSIST, MERGE, REMOVE, REFRESH};
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="cascade-all" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="cascade-persist" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="cascade-merge" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="cascade-remove" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="cascade-refresh" type="orm:emptyType"
+ minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="one-to-one">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface OneToOne {
+ Class targetEntity() default void.class;
+ CascadeType[] cascade() default {};
+ FetchType fetch() default EAGER;
+ boolean optional() default true;
+ String mappedBy() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element name="primary-key-join-column"
+ type="orm:primary-key-join-column"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="join-column" type="orm:join-column"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="join-table" type="orm:join-table"
+ minOccurs="0"/>
+ </xsd:choice>
+ <xsd:element name="cascade" type="orm:cascade-type"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="target-entity" type="xsd:string"/>
+ <xsd:attribute name="fetch" type="orm:fetch-type"/>
+ <xsd:attribute name="optional" type="xsd:boolean"/>
+ <xsd:attribute name="mapped-by" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="one-to-many">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface OneToMany {
+ Class targetEntity() default void.class;
+ CascadeType[] cascade() default {};
+ FetchType fetch() default LAZY;
+ String mappedBy() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="order-by" type="orm:order-by"
+ minOccurs="0"/>
+ <xsd:element name="map-key" type="orm:map-key"
+ minOccurs="0"/>
+ <xsd:choice>
+ <xsd:element name="join-table" type="orm:join-table"
+ minOccurs="0"/>
+ <xsd:element name="join-column" type="orm:join-column"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:choice>
+ <xsd:element name="cascade" type="orm:cascade-type"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="target-entity" type="xsd:string"/>
+ <xsd:attribute name="fetch" type="orm:fetch-type"/>
+ <xsd:attribute name="mapped-by" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="join-table">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface JoinTable {
+ String name() default "";
+ String catalog() default "";
+ String schema() default "";
+ JoinColumn[] joinColumns() default {};
+ JoinColumn[] inverseJoinColumns() default {};
+ UniqueConstraint[] uniqueConstraints() default {};
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="join-column" type="orm:join-column"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="inverse-join-column" type="orm:join-column"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="unique-constraint" type="orm:unique-constraint"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="catalog" type="xsd:string"/>
+ <xsd:attribute name="schema" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="many-to-many">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface ManyToMany {
+ Class targetEntity() default void.class;
+ CascadeType[] cascade() default {};
+ FetchType fetch() default LAZY;
+ String mappedBy() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="order-by" type="orm:order-by"
+ minOccurs="0"/>
+ <xsd:element name="map-key" type="orm:map-key"
+ minOccurs="0"/>
+ <xsd:element name="join-table" type="orm:join-table"
+ minOccurs="0"/>
+ <xsd:element name="cascade" type="orm:cascade-type"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="target-entity" type="xsd:string"/>
+ <xsd:attribute name="fetch" type="orm:fetch-type"/>
+ <xsd:attribute name="mapped-by" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="generated-value">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface GeneratedValue {
+ GenerationType strategy() default AUTO;
+ String generator() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="strategy" type="orm:generation-type"/>
+ <xsd:attribute name="generator" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="map-key">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface MapKey {
+ String name() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="order-by">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface OrderBy {
+ String value() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="inheritance">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface Inheritance {
+ InheritanceType strategy() default SINGLE_TABLE;
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="strategy" type="orm:inheritance-type"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="inheritance-type">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ public enum InheritanceType
+ { SINGLE_TABLE, JOINED, TABLE_PER_CLASS};
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="SINGLE_TABLE"/>
+ <xsd:enumeration value="JOINED"/>
+ <xsd:enumeration value="TABLE_PER_CLASS"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="discriminator-value">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface DiscriminatorValue {
+ String value();
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:simpleType name="discriminator-type">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ public enum DiscriminatorType { STRING, CHAR, INTEGER };
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="STRING"/>
+ <xsd:enumeration value="CHAR"/>
+ <xsd:enumeration value="INTEGER"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="primary-key-join-column">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface PrimaryKeyJoinColumn {
+ String name() default "";
+ String referencedColumnName() default "";
+ String columnDefinition() default "";
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="referenced-column-name" type="xsd:string"/>
+ <xsd:attribute name="column-definition" type="xsd:string"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="discriminator-column">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface DiscriminatorColumn {
+ String name() default "DTYPE";
+ DiscriminatorType discriminatorType() default STRING;
+ String columnDefinition() default "";
+ int length() default 31;
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string"/>
+ <xsd:attribute name="discriminator-type" type="orm:discriminator-type"/>
+ <xsd:attribute name="column-definition" type="xsd:string"/>
+ <xsd:attribute name="length" type="xsd:int"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="embeddable">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the settings and mappings for embeddable objects. Is
+ allowed to be sparsely populated and used in conjunction with
+ the annotations. Alternatively, the metadata-complete attribute
+ can be used to indicate that no annotations are to be processed
+ in the class. If this is the case then the defaulting rules will
+ be recursively applied.
+
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface Embeddable {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="attributes" type="orm:embeddable-attributes"
+ minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="class" type="xsd:string" use="required"/>
+ <xsd:attribute name="access" type="orm:access-type"/>
+ <xsd:attribute name="metadata-complete" type="xsd:boolean"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="embeddable-attributes">
+ <xsd:sequence>
+ <xsd:element name="basic" type="orm:basic"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="transient" type="orm:transient"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="embedded">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Embedded {}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="attribute-override" type="orm:attribute-override"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="mapped-superclass">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ Defines the settings and mappings for a mapped superclass. Is
+ allowed to be sparsely populated and used in conjunction with
+ the annotations. Alternatively, the metadata-complete attribute
+ can be used to indicate that no annotations are to be processed
+ If this is the case then the defaulting rules will be recursively
+ applied.
+
+ @Target(TYPE) @Retention(RUNTIME)
+ public @interface MappedSuperclass{}
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="description" type="xsd:string" minOccurs="0"/>
+ <xsd:element name="id-class" type="orm:id-class" minOccurs="0"/>
+ <xsd:element name="exclude-default-listeners" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="exclude-superclass-listeners" type="orm:emptyType"
+ minOccurs="0"/>
+ <xsd:element name="entity-listeners" type="orm:entity-listeners"
+ minOccurs="0"/>
+ <xsd:element name="pre-persist" type="orm:pre-persist" minOccurs="0"/>
+ <xsd:element name="post-persist" type="orm:post-persist"
+ minOccurs="0"/>
+ <xsd:element name="pre-remove" type="orm:pre-remove" minOccurs="0"/>
+ <xsd:element name="post-remove" type="orm:post-remove" minOccurs="0"/>
+ <xsd:element name="pre-update" type="orm:pre-update" minOccurs="0"/>
+ <xsd:element name="post-update" type="orm:post-update" minOccurs="0"/>
+ <xsd:element name="post-load" type="orm:post-load" minOccurs="0"/>
+ <xsd:element name="attributes" type="orm:attributes" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="class" type="xsd:string" use="required"/>
+ <xsd:attribute name="access" type="orm:access-type"/>
+ <xsd:attribute name="metadata-complete" type="xsd:boolean"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="sequence-generator">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface SequenceGenerator {
+ String name();
+ String sequenceName() default "";
+ int initialValue() default 1;
+ int allocationSize() default 50;
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="sequence-name" type="xsd:string"/>
+ <xsd:attribute name="initial-value" type="xsd:int"/>
+ <xsd:attribute name="allocation-size" type="xsd:int"/>
+ </xsd:complexType>
+
+ <!-- **************************************************** -->
+
+ <xsd:complexType name="table-generator">
+ <xsd:annotation>
+ <xsd:documentation>
+
+ @Target({TYPE, METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface TableGenerator {
+ String name();
+ String table() default "";
+ String catalog() default "";
+ String schema() default "";
+ String pkColumnName() default "";
+ String valueColumnName() default "";
+ String pkColumnValue() default "";
+ int initialValue() default 0;
+ int allocationSize() default 50;
+ UniqueConstraint[] uniqueConstraints() default {};
+ }
+
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="unique-constraint" type="orm:unique-constraint"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="table" type="xsd:string"/>
+ <xsd:attribute name="catalog" type="xsd:string"/>
+ <xsd:attribute name="schema" type="xsd:string"/>
+ <xsd:attribute name="pk-column-name" type="xsd:string"/>
+ <xsd:attribute name="value-column-name" type="xsd:string"/>
+ <xsd:attribute name="pk-column-value" type="xsd:string"/>
+ <xsd:attribute name="initial-value" type="xsd:int"/>
+ <xsd:attribute name="allocation-size" type="xsd:int"/>
+ </xsd:complexType>
+
+</xsd:schema>
+
+
Property changes on: core/trunk/annotations/src/main/resources/org/hibernate/ejb/orm_1_0.xsd
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: core/trunk/annotations/src/test/resources/hibernate.properties
===================================================================
--- core/trunk/annotations/src/test/resources/hibernate.properties 2008-10-30 09:05:38 UTC (rev 15451)
+++ core/trunk/annotations/src/test/resources/hibernate.properties 2008-10-30 12:36:16 UTC (rev 15452)
@@ -36,4 +36,6 @@
hibernate.max_fetch_depth 5
hibernate.cache.region_prefix hibernate.test
-hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
\ No newline at end of file
+hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
+
+hibernate.cache.use_query_cache true
16 years, 2 months
Hibernate SVN: r15451 - in core/trunk/envers: src/test/resources and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-30 05:05:38 -0400 (Thu, 30 Oct 2008)
New Revision: 15451
Modified:
core/trunk/envers/pom.xml
core/trunk/envers/src/test/resources/hibernate.test.cfg.xml
Log:
- Using an in-memory db for testing
- removed dependency on hsqldb
- changed the description
Modified: core/trunk/envers/pom.xml
===================================================================
--- core/trunk/envers/pom.xml 2008-10-30 08:24:20 UTC (rev 15450)
+++ core/trunk/envers/pom.xml 2008-10-30 09:05:38 UTC (rev 15451)
@@ -1,7 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -16,7 +15,7 @@
<packaging>jar</packaging>
<name>Hibernate Envers</name>
- <description>Support for entity historizing</description>
+ <description>Support for entity auditing</description>
<build>
<plugins>
@@ -126,7 +125,6 @@
<artifactId>ant</artifactId>
<scope>provided</scope>
</dependency>
-
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
@@ -135,12 +133,6 @@
<classifier>jdk15</classifier>
</dependency>
<dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <version>1.8.0.7</version>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
@@ -197,5 +189,4 @@
<!-- for now, at least, lets aggregate them -->
<jbossenvers.reports.aggregate>true</jbossenvers.reports.aggregate>
</properties>
-
</project>
Modified: core/trunk/envers/src/test/resources/hibernate.test.cfg.xml
===================================================================
--- core/trunk/envers/src/test/resources/hibernate.test.cfg.xml 2008-10-30 08:24:20 UTC (rev 15450)
+++ core/trunk/envers/src/test/resources/hibernate.test.cfg.xml 2008-10-30 09:05:38 UTC (rev 15451)
@@ -15,7 +15,7 @@
<property name="connection.password"></property>-->
<property name="dialect">org.hibernate.dialect.H2Dialect</property>
- <property name="connection.url">jdbc:h2:/tmp/envers/test</property>
+ <property name="connection.url">jdbc:h2:mem:envers</property>
<property name="connection.driver_class">org.h2.Driver</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
16 years, 2 months
Hibernate SVN: r15450 - in core/trunk/envers: src/test/resources and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2008-10-30 04:24:20 -0400 (Thu, 30 Oct 2008)
New Revision: 15450
Modified:
core/trunk/envers/pom.xml
core/trunk/envers/src/test/resources/hibernate.test.cfg.xml
Log:
Tests pass, using h2
Modified: core/trunk/envers/pom.xml
===================================================================
--- core/trunk/envers/pom.xml 2008-10-29 23:15:41 UTC (rev 15449)
+++ core/trunk/envers/pom.xml 2008-10-30 08:24:20 UTC (rev 15450)
@@ -145,6 +145,11 @@
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>1.0.79</version>
+ </dependency>
</dependencies>
<dependencyManagement>
Modified: core/trunk/envers/src/test/resources/hibernate.test.cfg.xml
===================================================================
--- core/trunk/envers/src/test/resources/hibernate.test.cfg.xml 2008-10-29 23:15:41 UTC (rev 15449)
+++ core/trunk/envers/src/test/resources/hibernate.test.cfg.xml 2008-10-30 08:24:20 UTC (rev 15450)
@@ -8,10 +8,16 @@
<session-factory>
<property name="hbm2ddl.auto">create-drop</property>
- <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
+ <!--<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="connection.url">jdbc:mysql:///hibernate_tests?useUnicode=true&characterEncoding=UTF-8</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.username">root</property>
+ <property name="connection.password"></property>-->
+
+ <property name="dialect">org.hibernate.dialect.H2Dialect</property>
+ <property name="connection.url">jdbc:h2:/tmp/envers/test</property>
+ <property name="connection.driver_class">org.h2.Driver</property>
+ <property name="connection.username">sa</property>
<property name="connection.password"></property>
<!--<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
16 years, 2 months
Hibernate SVN: r15449 - core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2008-10-29 19:15:41 -0400 (Wed, 29 Oct 2008)
New Revision: 15449
Modified:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java
Log:
Oops, make it use mvcc
Modified: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java 2008-10-29 23:14:54 UTC (rev 15448)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java 2008-10-29 23:15:41 UTC (rev 15449)
@@ -38,7 +38,7 @@
*/
public class MVCCJBossCacheTest extends AbstractQueryCacheFunctionalTestCase {
- private static final String JBC_CONFIG = "org/hibernate/test/cache/jbc2/functional/pessimistic-treecache.xml";
+ private static final String JBC_CONFIG = "org/hibernate/test/cache/jbc2/functional/mvcc-treecache.xml";
public MVCCJBossCacheTest(String x) {
super(x);
16 years, 2 months
Hibernate SVN: r15448 - core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional.
by hibernate-commits@lists.jboss.org
Author: bstansberry(a)jboss.com
Date: 2008-10-29 19:14:54 -0400 (Wed, 29 Oct 2008)
New Revision: 15448
Added:
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java
core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/mvcc-treecache.xml
Log:
Add MVCCJBossCacheTest
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/MVCCJBossCacheTest.java 2008-10-29 23:14:54 UTC (rev 15448)
@@ -0,0 +1,64 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.test.cache.jbc2.functional;
+
+import junit.framework.Test;
+
+import org.hibernate.cache.RegionFactory;
+import org.hibernate.cache.jbc2.JBossCacheRegionFactory;
+import org.hibernate.cache.jbc2.builder.SharedCacheInstanceManager;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * Basic functional test of a pessimistic locking entity + query cache.
+ *
+ * @author Brian Stansberry
+ */
+public class MVCCJBossCacheTest extends AbstractQueryCacheFunctionalTestCase {
+
+ private static final String JBC_CONFIG = "org/hibernate/test/cache/jbc2/functional/pessimistic-treecache.xml";
+
+ public MVCCJBossCacheTest(String x) {
+ super(x);
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite(MVCCJBossCacheTest.class);
+ }
+
+ protected Class<? extends RegionFactory> getCacheRegionFactory() {
+ return JBossCacheRegionFactory.class;
+ }
+
+ /**
+ * Apply any region-factory specific configurations.
+ *
+ * @param the Configuration to update.
+ */
+ protected void configureCacheFactory(Configuration cfg) {
+ cfg.setProperty(SharedCacheInstanceManager.CACHE_RESOURCE_PROP, JBC_CONFIG);
+ }
+
+}
Added: core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/mvcc-treecache.xml
===================================================================
--- core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/mvcc-treecache.xml (rev 0)
+++ core/branches/JBOSS_CACHE_3/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/mvcc-treecache.xml 2008-10-29 23:14:54 UTC (rev 15448)
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ ~ Hibernate, Relational Persistence for Idiomatic Java
+ ~
+ ~ Copyright (c) 2007, Red Hat Middleware LLC or third-party contributors as
+ ~ indicated by the @author tags or express copyright attribution
+ ~ statements applied by the authors. All third-party contributions are
+ ~ distributed under license by Red Hat Middleware LLC.
+ ~
+ ~ This copyrighted material is made available to anyone wishing to use, modify,
+ ~ copy, or redistribute it subject to the terms and conditions of the GNU
+ ~ Lesser General Public License, as published by the Free Software Foundation.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ ~ for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public License
+ ~ along with this distribution; if not, write to:
+ ~ Free Software Foundation, Inc.
+ ~ 51 Franklin Street, Fifth Floor
+ ~ Boston, MA 02110-1301 USA
+ -->
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Sample TreeCache Service Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<server>
+
+ <classpath codebase="./lib" archives="jboss-cache.jar, jgroups.jar"/>
+
+
+ <!-- ==================================================================== -->
+ <!-- Defines TreeCache configuration -->
+ <!-- ==================================================================== -->
+
+ <mbean code="org.jboss.cache.jmx.CacheJmxWrapper"
+ name="jboss.cache:service=TreeCache">
+
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
+
+ <!--
+ Node locking scheme:
+ OPTIMISTIC
+ PESSIMISTIC
+ MVCC (default)
+ -->
+ <attribute name="NodeLockingScheme">MVCC</attribute>
+
+ <!--
+ TransactionManager configuration not required for Hibernate!
+ Hibernate will plug in its own transaction manager integration.
+ -->
+
+ <attribute name="IsolationLevel">READ_COMMITTED</attribute>
+
+ <!--
+ Valid modes are LOCAL
+ REPL_ASYNC
+ REPL_SYNC
+ -->
+ <attribute name="CacheMode">LOCAL</attribute>
+
+ <!-- Name of cluster. Needs to be the same for all clusters, in order
+ to find each other
+ -->
+ <attribute name="ClusterName">TreeCache-Cluster</attribute>
+
+ <attribute name="ClusterConfig">
+ <config>
+ <!-- UDP: if you have a multihomed machine,
+ set the bind_addr attribute to the appropriate NIC IP address -->
+ <!-- UDP: On Windows machines, because of the media sense feature
+ being broken with multicast (even after disabling media sense)
+ set the loopback attribute to true -->
+ <UDP mcast_addr="228.1.2.3" mcast_port="45566"
+ ip_ttl="64" ip_mcast="true"
+ mcast_send_buf_size="150000" mcast_recv_buf_size="80000"
+ ucast_send_buf_size="150000" ucast_recv_buf_size="80000"
+ loopback="false"/>
+ <PING timeout="2000" num_initial_members="3"/>
+ <MERGE2 min_interval="10000" max_interval="20000"/>
+ <FD shun="true"/>
+ <VERIFY_SUSPECT timeout="1500"/>
+ <pbcast.NAKACK gc_lag="50" retransmit_timeout="600,1200,2400,4800"/>
+ <pbcast.STABLE desired_avg_gossip="20000"/>
+ <UNICAST timeout="600,1200,2400" min_threshold="10"/>
+ <FRAG frag_size="8192"/>
+ <pbcast.GMS join_timeout="5000" shun="true" print_local_addr="true"/>
+ <pbcast.STATE_TRANSFER/>
+ </config>
+ </attribute>
+
+ <!-- Must be true if any entity deployment uses a scoped classloader -->
+ <attribute name="UseRegionBasedMarshalling">true</attribute>
+ <!-- Must match the value of "useRegionBasedMarshalling" -->
+ <attribute name="InactiveOnStartup">true</attribute>
+
+ <!--
+ The max amount of time (in milliseconds) we wait until the
+ initial state (ie. the contents of the cache) are retrieved from
+ existing members in a clustered environment
+ -->
+ <attribute name="StateRetrievalTimeout">20000</attribute>
+
+ <!--
+ Number of milliseconds to wait until all responses for a
+ synchronous call have been received.
+ -->
+ <attribute name="SyncReplTimeout">20000</attribute>
+
+ <!-- Max number of milliseconds to wait for a lock acquisition -->
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+ <!-- For now. disable asynchronous RPC marshalling/sending -->
+ <attribute name="SerializationExecutorPoolSize">0</attribute>
+
+ <!-- Specific eviction policy configurations. This is LRU -->
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+ <!-- Name of the DEFAULT eviction policy class. -->
+ <attribute name="policyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+ <!-- Cache wide default -->
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ <!-- Don't ever evict modification timestamps -->
+ <region name="/TS">
+ <attribute name="maxNodes">0</attribute>
+ <attribute name="timeToLiveSeconds">0</attribute>
+ </region>
+ </config>
+ </attribute>
+ </mbean>
+
+
+</server>
16 years, 2 months