You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2006/04/26 22:58:50 UTC
svn commit: r396882 [8/11] - in /incubator/cayenne: branches/ tags/ trunk/
trunk/cayenne-jpa-tck/ trunk/cayenne-jpa-tck/.settings/
trunk/cayenne-jpa-tck/src/ trunk/cayenne-jpa-tck/src/main/
trunk/cayenne-jpa-tck/src/main/java/ trunk/cayenne-jpa-tck/src...
Added: incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/schemas/orm_1_0.xsd
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/schemas/orm_1_0.xsd?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/schemas/orm_1_0.xsd (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/schemas/orm_1_0.xsd Tue Apr 25 06:43:00 2006
@@ -0,0 +1,1053 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Java Persistence orm.xml 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 Dec 9 2005
+ </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:include schemaLocation="orm_1_0.xsd"/>
+ <!-- **************************************************** -->
+ <xsd:element name="entity-mappings">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="entity" type="orm:entity"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="embeddable" type="orm:embeddable"
+ minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="mapped-superclass" type="orm:mapped-superclass"
+ 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="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="default-entity-listeners"
+ type="orm:entity-listeners"
+ minOccurs="0"/>
+ <xsd:element name="cascade"
+ type="orm:cascade-type"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="package" type="xsd:string"/>
+ <xsd:attribute name="catalog" type="xsd:string"/>
+ <xsd:attribute name="schema" type="xsd:string"/>
+ <xsd:attribute name="access" type="orm:access-type"/>
+ <xsd:attribute name="flush-mode" type="orm:flush-mode-type"/>
+ </xsd:complexType>
+</xsd:element>
+ <xsd:complexType name="entity">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target(TYPE) @Retention(RUNTIME)
+ public @interface Entity {
+ String name() default "";
+ }
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <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="attribute-override" type="orm:attribute-override"
+ 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"/>
+ <xsd:element name="exclude-default-listeners" type="xsd:boolean"
+ minOccurs="0"/>
+ <xsd:element name="exclude-superclass-listeners" type="xsd:boolean"
+ 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: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="attribute" type="orm:attribute"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </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: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"/>
+ <xsd:element name="generated-value" type="orm:generated-value"/>
+ <xsd:element name="temporal" type="orm:temporal"/>
+ </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="attribute">
+ <xsd:sequence>
+ <xsd:choice minOccurs="0">
+ <xsd:element name="basic" type="orm:basic"/>
+ <xsd:element name="version" type="orm:version"/>
+ <xsd:element name="many-to-one" type="orm:many-to-one"/>
+ <xsd:element name="one-to-many" type="orm:one-to-many"/>
+ <xsd:element name="one-to-one" type="orm:one-to-one"/>
+ <xsd:element name="many-to-many" type="orm:many-to-many"/>
+ <xsd:element name="embedded" type="orm:embedded"/>
+ <xsd:element name="transient" type="orm:transient"/>
+ </xsd:choice>
+ <xsd:choice minOccurs="0">
+ <xsd:element name="column" type="orm:column"/>
+ <xsd:element name="join-column" type="orm:join-column"
+ maxOccurs="unbounded"/>
+ <xsd:element name="join-table" type="orm:join-table"/>
+ </xsd:choice>
+ <xsd:choice minOccurs="0">
+ <xsd:element name="lob" type="orm:lob"/>
+ <xsd:element name="temporal" type="orm:temporal"/>
+ <xsd:element name="enumerated" type="orm:enumerated"/>
+ <xsd:element name="map-key" type="orm:map-key"/>
+ <xsd:element name="order-by" type="orm:order-by"/>
+ </xsd:choice>
+ <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:simpleType name="access-type">
+ <xsd:annotation>
+ <xsd:documentation>
+ public enum AccessType { PROPERTY, FIELD };
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <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: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:simpleType name="flush-mode-type">
+ <xsd:annotation>
+ <xsd:documentation>
+ public enum FlushModeType {
+ COMMIT,
+ AUTO
+ }
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="COMMIT"/>
+ <xsd:enumeration value="AUTO"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <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="hint" type="orm:query-hint"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="query" 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();
+ String resultSetMapping() default"";//nameofSQLResultSetMapping
+ }
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <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="query" 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, METHOD}) @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({TYPE}) @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:string">
+ <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:simpleType name="id-class">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface IdClass {
+ Class value();
+ }
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="transient">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Transient {}
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:simpleType name="version">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Version {}
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <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: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:string">
+ <xsd:enumeration value="LAZY"/>
+ <xsd:enumeration value="EAGER"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="lob">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Lob {}
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:length value="0"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:simpleType name="temporal">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Temporal {
+ TemporalType value() default TIMESTAMP;
+ }
+ </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:string">
+ <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:string">
+ <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();
+ CascadeType[] cascade() default {};
+ FetchType fetch() default EAGER;
+ boolean optional() default true;
+ }
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="cascade" type="orm:cascade-type"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <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:simpleType name="cascade-type">
+ <xsd:annotation>
+ <xsd:documentation>
+ public enum CascadeType { ALL, PERSIST, MERGE, REMOVE, REFRESH};
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="ALL"/>
+ <xsd:enumeration value="PERSIST"/>
+ <xsd:enumeration value="MERGE"/>
+ <xsd:enumeration value="REMOVE"/>
+ <xsd:enumeration value="REFRESH"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:complexType name="one-to-one">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface OneToOne {
+ Class targetEntity();
+ CascadeType[] cascade() default {};
+ FetchType fetch() default EAGER;
+ boolean optional() default true;
+ String mappedBy() default "";
+ }
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="cascade" type="orm:cascade-type"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <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();
+ CascadeType[] cascade() default {};
+ FetchType fetch() default LAZY;
+ String mappedBy() default "";
+ }
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="cascade" type="orm:cascade-type"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <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})
+ 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();
+ CascadeType[] cascade() default {};
+ FetchType fetch() default LAZY;
+ String mappedBy() default "";
+ }
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="cascade" type="orm:cascade-type"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <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:string">
+ <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:string">
+ <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 "";
+ 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>
+ @Target({TYPE}) @Retention(RUNTIME)
+ public @interface Embeddable {}
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="embeddable-attribute"
+ type="orm:embeddable-attribute"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="class" type="xsd:string" use="required"/>
+ <xsd:attribute name="access" type="orm:access-type"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="embeddable-attribute">
+ <xsd:sequence>
+ <xsd:element name="basic" type="orm:basic" minOccurs="0"/>
+ <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:element name="column" type="orm:column" minOccurs="0"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ </xsd:complexType>
+
+ <xsd:simpleType name="embedded">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target({METHOD, FIELD}) @Retention(RUNTIME)
+ public @interface Embedded {}
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string"/>
+ </xsd:simpleType>
+
+ <xsd:complexType name="mapped-superclass">
+ <xsd:annotation>
+ <xsd:documentation>
+ @Target(TYPE) @Retention(RUNTIME)
+ public @interface MappedSuperclass{}
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="id-class" type="orm:id-class" minOccurs="0"/>
+ <xsd:element name="exclude-default-listeners" type="xsd:boolean"
+ minOccurs="0"/>
+ <xsd:element name="exclude-superclass-listeners" type="xsd:boolean"
+ minOccurs="0"/>
+ <xsd:element name="entity-listener" type="orm:entity-listener"
+ 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: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="attribute" type="orm:attribute"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="class" type="xsd:string" use="required"/>
+ <xsd:attribute name="access" type="orm:access-type"/>
+ </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 0;
+ 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>
+
Added: incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/schemas/persistence_1_0.xsd
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/schemas/persistence_1_0.xsd?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/schemas/persistence_1_0.xsd (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/schemas/persistence_1_0.xsd Tue Apr 25 06:43:00 2006
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Java Persistence persistence.xml schema -->
+<xsd:schema targetNamespace="http://java.sun.com/xml/ns/persistence"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:persistence="http://java.sun.com/xml/ns/persistence"
+ elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
+ <xsd:annotation>
+ <xsd:documentation>
+ @(#)persistence_1_0.xsd 1.0 Dec 1 2005
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:annotation>
+ <xsd:documentation><![CDATA[
+ This is the XML Schema for the persistence configuration file.
+ The file must be named "META-INF/persistence.xml" in the
+ persistence archive.
+ Persistence configuration files must indicate
+ the persistence schema by using the persistence namespace:
+ http://java.sun.com/xml/ns/persistence
+ and indicate the version of the schema by
+ using the version element as shown below:
+ <persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ ...
+ </persistence>
+ ]]></xsd:documentation>
+ </xsd:annotation>
+ <xsd:include schemaLocation="persistence_1_0.xsd"/>
+ <!-- ********************************************* -->
+ <xsd:element name="persistence">
+ <xsd:complexType>
+ <xsd:sequence>
+ <!-- ************************************* -->
+ <xsd:element name="persistence-unit"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:annotation>
+ <xsd:documentation>
+ Configuration of a persistence unit.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+ <!-- ************************************* -->
+ <xsd:element name="description" type="xsd:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ Textual description of this persistence unit.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ************************************* -->
+ <xsd:element name="provider" type="xsd:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ Provider class that supplies EntityManagers
+ for this persistence unit.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ************************************* -->
+ <xsd:element name="jta-data-source" type="xsd:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+The container-specific name of the JTA datasource to use.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ************************************* -->
+ <xsd:element name="non-jta-data-source"
+ type="xsd:string"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+The container-specific name of a non-JTA datasource to use.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ************************************* -->
+ <xsd:element name="mapping-file" type="xsd:string"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+ File containing mapping information. Loaded as a
+ resource by the persistence provider.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ************************************* -->
+ <xsd:element name="jar-file" type="xsd:string"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+ Jar file that should be scanned for entities.
+ Not applicable to Java SE persistence units.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ************************************* -->
+ <xsd:element name="class" type="xsd:string"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+ Class to scan for annotations. It should be
+ annotated with either @Entity, @Embeddable or
+ @MappedSuperclass
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ************************************* -->
+ <xsd:element name="exclude-unlisted-classes"
+ type="xsd:boolean"
+ default="false"
+ minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ When set to true then only listed classes and
+ jars will be scanned for persistent classes,
+ otherwise the enclosing jar or directory will
+ also be scanned.
+ Not applicable to Java SE persistence units.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <!-- ************************************* -->
+ <xsd:element name="properties" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ A list of vendor-specific properties.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="property"
+ minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>
+ A name-value pair.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:attribute name="name" type="xsd:string"
+ use="required"/>
+ <xsd:attribute name="value" type="xsd:string"
+ use="required"/>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ <!-- ************************************* -->
+ <xsd:attribute name="name" type="xsd:string" use="required">
+ <xsd:annotation>
+ <xsd:documentation>
+ Name used in code to reference this persistence unit.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ <!-- ************************************* -->
+ <xsd:attribute name="transaction-type"
+ type="persistence:persistent-unit-transaction-type">
+ <xsd:annotation>
+ <xsd:documentation>
+ Type of transactions used by EntityManagers
+ from this persistence unit.
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <!-- ********************************************* -->
+ <xsd:simpleType name="persistent-unit-transaction-type">
+ <xsd:annotation>
+ <xsd:documentation>
+ public enum TransactionType { JTA, RESOURCE_LOCAL };
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="JTA"/>
+ <xsd:enumeration value="RESOURCE_LOCAL"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+</xsd:schema>
\ No newline at end of file
Added: incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/resources/META-INF/services/javax.persistence.spi.PersistenceProvider Tue Apr 25 06:43:00 2006
@@ -0,0 +1 @@
+org.objectstyle.cayenne.jpa.cspi.CjpaPersistenceProvider
\ No newline at end of file
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/JpaEntityManagerFactoryTest.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/JpaEntityManagerFactoryTest.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/JpaEntityManagerFactoryTest.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/JpaEntityManagerFactoryTest.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,53 @@
+package org.objectstyle.cayenne.jpa;
+
+import javax.persistence.PersistenceContextType;
+
+import org.objectstyle.cayenne.jpa.spi.MockPersistenceUnitInfo;
+
+import junit.framework.TestCase;
+
+public class JpaEntityManagerFactoryTest extends TestCase {
+
+ public void testOpenClose() {
+ JpaEntityManagerFactory f = new MockJpaEntityManagerFactory(
+ new MockPersistenceUnitInfo());
+ assertTrue(f.isOpen());
+
+ f.close();
+
+ assertFalse(f.isOpen());
+
+ // check that all methods throw
+ try {
+ f.close();
+ fail("Closed EntityManagerFactory is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+
+ try {
+ f.createEntityManager();
+ fail("Closed EntityManagerFactory is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+
+ try {
+ f.createEntityManager(PersistenceContextType.EXTENDED);
+ fail("Closed EntityManagerFactory is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+
+ try {
+ f.getEntityManager();
+ fail("Closed EntityManagerFactory is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+ }
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/JpaEntityManagerTest.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/JpaEntityManagerTest.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/JpaEntityManagerTest.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/JpaEntityManagerTest.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,111 @@
+package org.objectstyle.cayenne.jpa;
+
+import javax.persistence.FlushModeType;
+
+import junit.framework.TestCase;
+
+public class JpaEntityManagerTest extends TestCase {
+
+ public void testOpenClose() throws Exception {
+ JpaEntityManager m = new MockJpaEntityManager(new MockEntityManagerFactory() {
+
+ @Override
+ public boolean isOpen() {
+ return true;
+ }
+ });
+
+ assertTrue(m.isOpen());
+
+ m.close();
+
+ assertFalse(m.isOpen());
+
+ // check that all methods throw ... or at least some :-)
+ try {
+ m.close();
+ fail("Closed EntityManager is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+
+ try {
+ m.contains(new Object());
+ fail("Closed EntityManager is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+
+ try {
+ m.createNamedQuery("X");
+ fail("Closed EntityManager is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+
+ try {
+ m.createNativeQuery("SELECT * FROM A");
+ fail("Closed EntityManager is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+
+ try {
+ m.setFlushMode(FlushModeType.AUTO);
+ fail("Closed EntityManager is supposed to throw");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+ }
+
+ public void testCloseActiveTransactionInProgress() {
+ JpaEntityManager m = new MockJpaEntityManager(new MockEntityManagerFactory() {
+
+ @Override
+ public boolean isOpen() {
+ return true;
+ }
+ });
+
+ assertTrue(m.isOpen());
+
+ m.setTransaction(new MockEntityTransaction() {
+
+ @Override
+ public boolean isActive() {
+ return true;
+ }
+ });
+
+ try {
+ m.close();
+ fail("EntityManager is supposed to throw on 'close' when it has transaction in progress");
+ }
+ catch (IllegalStateException e) {
+ // expected
+ }
+ }
+
+ public void testCloseFactoryClosed() {
+ final boolean[] factoryCloseState = new boolean[1];
+
+ JpaEntityManager m = new MockJpaEntityManager(new MockEntityManagerFactory() {
+
+ @Override
+ public boolean isOpen() {
+ return !factoryCloseState[0];
+ }
+ });
+
+ assertTrue(m.isOpen());
+
+ factoryCloseState[0] = true;
+
+ assertFalse(m.isOpen());
+ }
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockEntityManagerFactory.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockEntityManagerFactory.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockEntityManagerFactory.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockEntityManagerFactory.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,60 @@
+package org.objectstyle.cayenne.jpa;
+
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.spi.PersistenceUnitInfo;
+
+public class MockEntityManagerFactory implements EntityManagerFactory {
+
+ protected String persistenceUnitName;
+ protected Map properties;
+ protected PersistenceUnitInfo info;
+
+ public MockEntityManagerFactory() {
+
+ }
+
+ public MockEntityManagerFactory(String persistenceUnitName, Map properties) {
+ this.persistenceUnitName = persistenceUnitName;
+ this.properties = properties;
+ }
+
+ public MockEntityManagerFactory(String persistenceUnitName, PersistenceUnitInfo info) {
+ this.persistenceUnitName = persistenceUnitName;
+ this.info = info;
+ }
+
+ public EntityManager createEntityManager() {
+ return null;
+ }
+
+ public EntityManager createEntityManager(PersistenceContextType type) {
+ return null;
+ }
+
+ public EntityManager getEntityManager() {
+ return null;
+ }
+
+ public void close() {
+ }
+
+ public boolean isOpen() {
+ return false;
+ }
+
+ public String getPersistenceUnitName() {
+ return persistenceUnitName;
+ }
+
+ public Map getProperties() {
+ return properties;
+ }
+
+ public PersistenceUnitInfo getInfo() {
+ return info;
+ }
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockEntityTransaction.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockEntityTransaction.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockEntityTransaction.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockEntityTransaction.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,19 @@
+package org.objectstyle.cayenne.jpa;
+
+import javax.persistence.EntityTransaction;
+
+public class MockEntityTransaction implements EntityTransaction {
+
+ public void begin() {
+ }
+
+ public void commit() {
+ }
+
+ public void rollback() {
+ }
+
+ public boolean isActive() {
+ return false;
+ }
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockJpaEntityManager.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockJpaEntityManager.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockJpaEntityManager.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockJpaEntityManager.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,63 @@
+package org.objectstyle.cayenne.jpa;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.Query;
+
+public class MockJpaEntityManager extends JpaEntityManager {
+
+ public MockJpaEntityManager(EntityManagerFactory factory) {
+ super(factory, PersistenceContextType.TRANSACTION);
+ }
+
+ public MockJpaEntityManager(EntityManagerFactory factory,
+ PersistenceContextType contextType) {
+ super(factory, contextType);
+ }
+
+ @Override
+ protected void persistInternal(Object entity) {
+ }
+
+ @Override
+ protected <T> T mergeInternal(T entity) {
+ return null;
+ }
+
+ @Override
+ protected void removeInternal(Object entity) {
+ }
+
+ @Override
+ protected <T> T findInternal(Class<T> entityClass, Object primaryKey) {
+ return null;
+ }
+
+ @Override
+ protected void flushInternal() {
+ }
+
+ @Override
+ protected void refreshInternal(Object entity) {
+ }
+
+ @Override
+ protected boolean containsInternal(Object entity) {
+ return false;
+ }
+
+ @Override
+ public Query createNativeQuery(String sqlString, Class resultClass) {
+ checkClosed();
+
+ return null;
+ }
+
+ @Override
+ public Query createNamedQuery(String name) {
+ checkClosed();
+
+ return null;
+ }
+
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockJpaEntityManagerFactory.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockJpaEntityManagerFactory.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockJpaEntityManagerFactory.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/MockJpaEntityManagerFactory.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,18 @@
+package org.objectstyle.cayenne.jpa;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContextType;
+import javax.persistence.spi.PersistenceUnitInfo;
+
+public class MockJpaEntityManagerFactory extends JpaEntityManagerFactory {
+
+ public MockJpaEntityManagerFactory(PersistenceUnitInfo unitInfo) {
+ super(unitInfo);
+ }
+
+ @Override
+ protected EntityManager createEntityManagerInternal(PersistenceContextType type) {
+ return null;
+ }
+
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/bridge/DataMapConverterTest.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/bridge/DataMapConverterTest.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/bridge/DataMapConverterTest.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/bridge/DataMapConverterTest.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,128 @@
+/* ====================================================================
+ *
+ * The ObjectStyle Group Software License, version 1.1
+ * ObjectStyle Group - http://objectstyle.org/
+ *
+ * Copyright (c) 2002-2005, Andrei (Andrus) Adamchik and individual authors
+ * of the software. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
+ * must include the following acknowlegement:
+ * "This product includes software developed by independent contributors
+ * and hosted on ObjectStyle Group web site (http://objectstyle.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "ObjectStyle Group" and "Cayenne" must not be used to endorse
+ * or promote products derived from this software without prior written
+ * permission. For written permission, email
+ * "andrus at objectstyle dot org".
+ *
+ * 5. Products derived from this software may not be called "ObjectStyle"
+ * or "Cayenne", nor may "ObjectStyle" or "Cayenne" appear in their
+ * names without prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE OBJECTSTYLE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals and hosted on ObjectStyle Group web site. For more
+ * information on the ObjectStyle Group, please see
+ * <http://objectstyle.org/>.
+ */
+package org.objectstyle.cayenne.jpa.bridge;
+
+import junit.framework.TestCase;
+
+import org.objectstyle.cayenne.jpa.conf.EntityMapAnnotationLoader;
+import org.objectstyle.cayenne.jpa.entity.MockEmbed1;
+import org.objectstyle.cayenne.jpa.entity.MockEmbed2;
+import org.objectstyle.cayenne.jpa.entity.MockEntity1;
+import org.objectstyle.cayenne.jpa.entity.MockEntity2;
+import org.objectstyle.cayenne.jpa.entity.MockEntity3;
+import org.objectstyle.cayenne.jpa.entity.MockEntity4;
+import org.objectstyle.cayenne.jpa.entity.MockEntity5;
+import org.objectstyle.cayenne.jpa.entity.MockEntityMap1;
+import org.objectstyle.cayenne.jpa.entity.MockEntityMap2;
+import org.objectstyle.cayenne.jpa.entity.MockMappedSuperclass1;
+import org.objectstyle.cayenne.jpa.entity.MockMappedSuperclass2;
+import org.objectstyle.cayenne.jpa.entity.MockMappedSuperclass3;
+import org.objectstyle.cayenne.jpa.map.JpaEntityMap;
+import org.objectstyle.cayenne.map.DataMap;
+import org.objectstyle.cayenne.validation.ValidationResult;
+
+public class DataMapConverterTest extends TestCase {
+
+ public void testDataMapDefaults() {
+ JpaEntityMap jpaMap = new JpaEntityMap();
+ jpaMap.setPackageName("p1");
+ jpaMap.setSchema("s1");
+
+ // TODO: unsupported by DataMap
+ // jpaMap.setCatalog("c1");
+
+ DataMap cayenneMap = new DataMapConverter(new ValidationResult()).toDataMap(
+ "n1",
+ jpaMap);
+ assertEquals("n1", cayenneMap.getName());
+ assertEquals("p1", cayenneMap.getDefaultPackage());
+ assertEquals("s1", cayenneMap.getDefaultSchema());
+ }
+
+ /**
+ * @see org.objectstyle.cayenne.jpa.conf.EntityMapAnnotationLoaderTest#testLoadClassMapping()
+ */
+ public void testLoadClassMapping() throws Exception {
+ JpaEntityMap map = new JpaEntityMap();
+ ValidationResult conflicts = new ValidationResult();
+ EntityMapAnnotationLoader loader = new EntityMapAnnotationLoader(conflicts);
+
+ loader.loadClassMapping(map, MockEntity1.class);
+ loader.loadClassMapping(map, MockEntity2.class);
+ loader.loadClassMapping(map, MockEntity3.class);
+ loader.loadClassMapping(map, MockEntity4.class);
+ loader.loadClassMapping(map, MockEntity5.class);
+
+ loader.loadClassMapping(map, MockEmbed1.class);
+ loader.loadClassMapping(map, MockEmbed2.class);
+
+ loader.loadClassMapping(map, MockMappedSuperclass1.class);
+ loader.loadClassMapping(map, MockMappedSuperclass2.class);
+ loader.loadClassMapping(map, MockMappedSuperclass3.class);
+
+ loader.loadClassMapping(map, MockEntityMap1.class);
+ loader.loadClassMapping(map, MockEntityMap2.class);
+
+ assertFalse("Found conflicts: " + conflicts, conflicts.hasFailures());
+
+ ValidationResult dataMapConflicts = new ValidationResult();
+ DataMap dataMap = new DataMapConverter(dataMapConflicts).toDataMap("n1", map);
+ assertFalse("Found DataMap conflicts: " + dataMapConflicts, dataMapConflicts
+ .hasFailures());
+
+ new DataMapMappingAssertion().testDataMap(dataMap);
+ }
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/bridge/DataMapMappingAssertion.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/bridge/DataMapMappingAssertion.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/bridge/DataMapMappingAssertion.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/bridge/DataMapMappingAssertion.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,123 @@
+/* ====================================================================
+ *
+ * The ObjectStyle Group Software License, version 1.1
+ * ObjectStyle Group - http://objectstyle.org/
+ *
+ * Copyright (c) 2002-2005, Andrei (Andrus) Adamchik and individual authors
+ * of the software. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
+ * must include the following acknowlegement:
+ * "This product includes software developed by independent contributors
+ * and hosted on ObjectStyle Group web site (http://objectstyle.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "ObjectStyle Group" and "Cayenne" must not be used to endorse
+ * or promote products derived from this software without prior written
+ * permission. For written permission, email
+ * "andrus at objectstyle dot org".
+ *
+ * 5. Products derived from this software may not be called "ObjectStyle"
+ * or "Cayenne", nor may "ObjectStyle" or "Cayenne" appear in their
+ * names without prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE OBJECTSTYLE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals and hosted on ObjectStyle Group web site. For more
+ * information on the ObjectStyle Group, please see
+ * <http://objectstyle.org/>.
+ */
+package org.objectstyle.cayenne.jpa.bridge;
+
+import junit.framework.Assert;
+
+import org.objectstyle.cayenne.map.DataMap;
+
+public class DataMapMappingAssertion extends Assert {
+
+ public void testDataMap(DataMap dataMap) {
+ assertNotNull(dataMap);
+ assertEquals("n1", dataMap.getName());
+
+ assertNotNull(dataMap.getObjEntities());
+ assertEquals(5, dataMap.getObjEntities().size());
+ // Iterator<ObjEntity> entityIt = dataMap.getObjEntities().iterator();
+ // assertEntity1(entityIt.next());
+ // assertEntity2(entityIt.next());
+ // assertEntity3(entityIt.next());
+ // assertEntity4(entityIt.next());
+ // assertEntity5(entityIt.next());
+
+ // TODO: NOT SUPPORTED YET - Embeddable
+ // assertNotNull(dataMap.getEmbeddables());
+ // assertEquals(2, dataMap.getEmbeddables().size());
+ // Iterator<JpaEmbeddable> embedIt = dataMap.getEmbeddables().iterator();
+ // assertEmbeddable1(embedIt.next());
+
+ // TODO: NOT SUPPORTED YET - Mapped Superclass
+ // assertNotNull(dataMap.getMappedSuperclasses());
+ // assertEquals(3, dataMap.getMappedSuperclasses().size());
+ // Iterator<JpaMappedSuperclass> mappedSuperclassIt = dataMap
+ // .getMappedSuperclasses()
+ // .iterator();
+ // assertMappedSuperclass1(mappedSuperclassIt.next());
+ // assertMappedSuperclass2(mappedSuperclassIt.next());
+ // assertMappedSuperclass3(mappedSuperclassIt.next());
+
+ // TODO: NOT SUPPORTED YET - EntityListeners
+ // assertEntityListeners(dataMap.getDefaultEntityListeners());
+
+ assertEquals(2, dataMap.getQueries().size());
+ // Iterator<Query> namedQueryIt = dataMap.getQueries().iterator();
+ // assertNamedQuery1(namedQueryIt.next());
+ // assertNamedQuery2(namedQueryIt.next());
+
+ // TODO: NOT SUPPORTED YET - Native Named Queries, however SQLTemplates are
+ // supported as named queries.
+ // assertEquals(2, entityMap.getNamedNativeQueries().size());
+ // Iterator<JpaNamedNativeQuery> namedNativeQueryIt = entityMap
+ // .getNamedNativeQueries()
+ // .iterator();
+ // assertNativeNamedQuery3(namedNativeQueryIt.next());
+ // assertNativeNamedQuery4(namedNativeQueryIt.next());
+
+ // TODO: NOT SUPPORTED YET - SQLResultSetMapping
+ // assertEquals(2, entityMap.getSqlResultSetMappings().size());
+ // assertSqlResultSetMapping(entityMap.getSqlResultSetMappings().iterator().next());
+
+ // TODO: NOT SUPPORTED YET - Sequencegenerators (In fact we can support that
+ // already...)
+// assertEquals(2, entityMap.getSequenceGenerators().size());
+// assertSequenceGenerator1(entityMap.getSequenceGenerators().iterator().next());
+
+ // TODO: NOT SUPPORTED YET - Table Generators (we can support that already)
+ // assertEquals(2, entityMap.getTableGenerators().size());
+ // assertTableGenerator(entityMap.getTableGenerators().iterator().next());
+ }
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/AnnotationMappingAssertion.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/AnnotationMappingAssertion.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/AnnotationMappingAssertion.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/AnnotationMappingAssertion.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,67 @@
+/* ====================================================================
+ *
+ * The ObjectStyle Group Software License, version 1.1
+ * ObjectStyle Group - http://objectstyle.org/
+ *
+ * Copyright (c) 2002-2005, Andrei (Andrus) Adamchik and individual authors
+ * of the software. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
+ * must include the following acknowlegement:
+ * "This product includes software developed by independent contributors
+ * and hosted on ObjectStyle Group web site (http://objectstyle.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "ObjectStyle Group" and "Cayenne" must not be used to endorse
+ * or promote products derived from this software without prior written
+ * permission. For written permission, email
+ * "andrus at objectstyle dot org".
+ *
+ * 5. Products derived from this software may not be called "ObjectStyle"
+ * or "Cayenne", nor may "ObjectStyle" or "Cayenne" appear in their
+ * names without prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE OBJECTSTYLE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals and hosted on ObjectStyle Group web site. For more
+ * information on the ObjectStyle Group, please see
+ * <http://objectstyle.org/>.
+ */
+package org.objectstyle.cayenne.jpa.conf;
+
+import org.objectstyle.cayenne.jpa.map.JpaEntity;
+
+class AnnotationMappingAssertion extends MappingAssertion {
+
+ @Override
+ protected void assertEntity1(JpaEntity entity1) {
+ super.assertEntity1(entity1);
+ assertNull(entity1.getAccess());
+ }
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/AnnotationProcessorFactoryTest.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/AnnotationProcessorFactoryTest.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/AnnotationProcessorFactoryTest.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/AnnotationProcessorFactoryTest.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,76 @@
+/* ====================================================================
+ *
+ * The ObjectStyle Group Software License, version 1.1
+ * ObjectStyle Group - http://objectstyle.org/
+ *
+ * Copyright (c) 2002-2005, Andrei (Andrus) Adamchik and individual authors
+ * of the software. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
+ * must include the following acknowlegement:
+ * "This product includes software developed by independent contributors
+ * and hosted on ObjectStyle Group web site (http://objectstyle.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "ObjectStyle Group" and "Cayenne" must not be used to endorse
+ * or promote products derived from this software without prior written
+ * permission. For written permission, email
+ * "andrus at objectstyle dot org".
+ *
+ * 5. Products derived from this software may not be called "ObjectStyle"
+ * or "Cayenne", nor may "ObjectStyle" or "Cayenne" appear in their
+ * names without prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE OBJECTSTYLE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals and hosted on ObjectStyle Group web site. For more
+ * information on the ObjectStyle Group, please see
+ * <http://objectstyle.org/>.
+ */
+package org.objectstyle.cayenne.jpa.conf;
+
+import javax.persistence.Entity;
+
+import junit.framework.TestCase;
+
+public class AnnotationProcessorFactoryTest extends TestCase {
+
+ public void testCreateProcessor() {
+
+ AnnotationProcessor p1 = new AnnotationProcessorFactory() {
+ }.createProcessor("mumbo-jumbo");
+ assertNotNull(p1);
+ assertSame(AnnotationProcessorFactory.NOOP_PROCESSOR, p1);
+ }
+
+ public void testAnnotationClass() {
+ assertEquals(Entity.class, AnnotationProcessorFactory
+ .annotationClass(ClassAnnotationProcessorFactory.EntityProcessor.class));
+ }
+}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/ClassAnnotationProcessorFactoryTest.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/ClassAnnotationProcessorFactoryTest.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/ClassAnnotationProcessorFactoryTest.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/conf/ClassAnnotationProcessorFactoryTest.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,70 @@
+/* ====================================================================
+ *
+ * The ObjectStyle Group Software License, version 1.1
+ * ObjectStyle Group - http://objectstyle.org/
+ *
+ * Copyright (c) 2002-2005, Andrei (Andrus) Adamchik and individual authors
+ * of the software. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any,
+ * must include the following acknowlegement:
+ * "This product includes software developed by independent contributors
+ * and hosted on ObjectStyle Group web site (http://objectstyle.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "ObjectStyle Group" and "Cayenne" must not be used to endorse
+ * or promote products derived from this software without prior written
+ * permission. For written permission, email
+ * "andrus at objectstyle dot org".
+ *
+ * 5. Products derived from this software may not be called "ObjectStyle"
+ * or "Cayenne", nor may "ObjectStyle" or "Cayenne" appear in their
+ * names without prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE OBJECTSTYLE GROUP OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals and hosted on ObjectStyle Group web site. For more
+ * information on the ObjectStyle Group, please see
+ * <http://objectstyle.org/>.
+ */
+package org.objectstyle.cayenne.jpa.conf;
+
+import javax.persistence.Entity;
+
+import junit.framework.TestCase;
+
+public class ClassAnnotationProcessorFactoryTest extends TestCase {
+
+ public void testEntityProcessor() {
+ AnnotationProcessor p2 = new ClassAnnotationProcessorFactory()
+ .createProcessor(Entity.class.getName());
+ assertNotNull(p2);
+ assertTrue(p2 instanceof ClassAnnotationProcessorFactory.EntityProcessor);
+ }
+}