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 [5/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/java/org/objectstyle/cayenne/jpa/map/JpaAttribute.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaAttribute.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaAttribute.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaAttribute.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,286 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.EnumType;
+import javax.persistence.TemporalType;
+
+/**
+ * Represents a mapping of an entity attribute.
+ * 
+ * @author Andrus Adamchik
+ */
+public class JpaAttribute {
+
+    public static enum AttributeSemantics {
+        BASIC, VERSION, MANY_TO_ONE, ONE_TO_MANY, ONE_TO_ONE, MANY_TO_MANY, EMBEDDED, TRANSIENT
+    }
+
+    public static enum AttributeMapping {
+        COLUMN, JOIN_COLUMN, JOIN_TABLE
+    }
+
+    public static enum AttributeType {
+        LOB, TEMPORAL, ENUMERATED, MAP_KEY, ORDER_BY
+    }
+
+    protected String name;
+    protected Collection<JpaAttributeOverride> attributeOverrides;
+
+    protected AttributeSemantics semantics;
+    protected JpaBasic basic;
+    protected JpaManyToOne manyToOne;
+    protected JpaOneToMany oneToMany;
+    protected JpaOneToOne oneToOne;
+    protected JpaManyToMany manyToMany;
+
+    protected AttributeMapping mapping;
+    protected JpaColumn column;
+    protected Collection<JpaJoinColumn> joinColumns;
+    protected JpaJoinTable joinTable;
+
+    protected AttributeType type;
+    protected TemporalType temporal;
+    protected EnumType enumerated = EnumType.ORDINAL;
+    protected String mapKey;
+    protected String orderBy;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Returns a non-null attribute overrides collection.
+     */
+    public Collection<JpaAttributeOverride> getAttributeOverrides() {
+        if (attributeOverrides == null) {
+            attributeOverrides = new ArrayList<JpaAttributeOverride>(1);
+        }
+
+        return attributeOverrides;
+    }
+
+    // **** Semantics properties
+
+    public JpaBasic getBasic() {
+        return basic;
+    }
+
+    public void setBasic(JpaBasic basic) {
+        this.semantics = AttributeSemantics.BASIC;
+        this.basic = basic;
+    }
+
+    public JpaManyToMany getManyToMany() {
+        return manyToMany;
+    }
+
+    public void setManyToMany(JpaManyToMany manyToMany) {
+        this.semantics = AttributeSemantics.MANY_TO_MANY;
+        this.manyToMany = manyToMany;
+    }
+
+    public JpaManyToOne getManyToOne() {
+        return manyToOne;
+    }
+
+    public void setManyToOne(JpaManyToOne manyToOne) {
+        this.semantics = AttributeSemantics.MANY_TO_ONE;
+        this.manyToOne = manyToOne;
+    }
+
+    public JpaOneToMany getOneToMany() {
+        return oneToMany;
+    }
+
+    public void setOneToMany(JpaOneToMany oneToMany) {
+        this.semantics = AttributeSemantics.ONE_TO_MANY;
+        this.oneToMany = oneToMany;
+    }
+
+    public JpaOneToOne getOneToOne() {
+        return oneToOne;
+    }
+
+    public void setOneToOne(JpaOneToOne oneToOne) {
+        this.semantics = AttributeSemantics.ONE_TO_ONE;
+        this.oneToOne = oneToOne;
+    }
+
+    public boolean isVersion() {
+        return semantics == AttributeSemantics.VERSION;
+    }
+
+    public void setVersion(boolean version) {
+        this.semantics = AttributeSemantics.VERSION;
+    }
+
+    public boolean isEmbedded() {
+        return semantics == AttributeSemantics.EMBEDDED;
+    }
+
+    public void setEmbedded(boolean isEmbeddded) {
+        this.semantics = isEmbeddded ? AttributeSemantics.EMBEDDED : null;
+    }
+
+    public boolean isTransient() {
+        return semantics == AttributeSemantics.TRANSIENT;
+    }
+
+    public void setTransient(boolean isTransient) {
+        this.semantics = isTransient ? AttributeSemantics.TRANSIENT : null;
+    }
+
+    // **** Mapping properties
+
+    public JpaColumn getColumn() {
+        return column;
+    }
+
+    public void setColumn(JpaColumn column) {
+        this.mapping = AttributeMapping.COLUMN;
+        this.column = column;
+    }
+
+    public Collection<JpaJoinColumn> getJoinColumns() {
+        if (joinColumns == null) {
+            joinColumns = new ArrayList<JpaJoinColumn>() {
+
+                @Override
+                public boolean add(JpaJoinColumn arg0) {
+                    JpaAttribute.this.mapping = AttributeMapping.JOIN_COLUMN;
+                    return super.add(arg0);
+                }
+
+                @Override
+                public void add(int arg0, JpaJoinColumn arg1) {
+                    JpaAttribute.this.mapping = AttributeMapping.JOIN_COLUMN;
+                    super.add(arg0, arg1);
+                }
+            };
+        }
+        return joinColumns;
+    }
+
+    public JpaJoinTable getJoinTable() {
+        return joinTable;
+    }
+
+    public void setJoinTable(JpaJoinTable joinTable) {
+        this.mapping = AttributeMapping.JOIN_TABLE;
+        this.joinTable = joinTable;
+    }
+
+    // **** Type properties
+
+    public boolean isLob() {
+        return type == AttributeType.LOB;
+    }
+
+    public void setLob(boolean isLob) {
+        this.type = isLob ? AttributeType.LOB : null;
+    }
+
+    /**
+     * A special setter used by XML decoder to indicate lob flag presence.
+     */
+    public void setLobTrue(String string) {
+        setLob(true);
+    }
+
+    public EnumType getEnumerated() {
+        return enumerated;
+    }
+
+    public void setEnumerated(EnumType enumerated) {
+        this.type = AttributeType.ENUMERATED;
+        this.enumerated = enumerated;
+    }
+
+    public String getMapKey() {
+        return mapKey;
+    }
+
+    public void setMapKey(String mapKey) {
+        this.type = AttributeType.MAP_KEY;
+        this.mapKey = mapKey;
+    }
+
+    public String getOrderBy() {
+        return orderBy;
+    }
+
+    public void setOrderBy(String orderBy) {
+        this.type = AttributeType.ORDER_BY;
+        this.orderBy = orderBy;
+    }
+
+    public TemporalType getTemporal() {
+        return temporal;
+    }
+
+    public void setTemporal(TemporalType temporal) {
+        this.type = AttributeType.TEMPORAL;
+        this.temporal = temporal;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaAttributeOverride.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaAttributeOverride.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaAttributeOverride.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaAttributeOverride.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,101 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import javax.persistence.AttributeOverride;
+
+public class JpaAttributeOverride {
+
+    protected String name;
+    protected JpaColumn column;
+
+    public JpaAttributeOverride() {
+
+    }
+
+    public JpaAttributeOverride(AttributeOverride annotation) {
+        name = annotation.name();
+
+        if (annotation.column() != null) {
+            column = new JpaColumn(annotation.column());
+        }
+    }
+
+    public JpaColumn getColumn() {
+        return column;
+    }
+
+    public void setColumn(JpaColumn column) {
+        this.column = column;
+    }
+
+    /**
+     * Returns overriden attribute name.
+     * <h3>Specification Documentation</h3>
+     * <p>
+     * <b>Description:</b> (Required) The name of the property in the embedded object
+     * that is being mapped if property-based access is being used, or the name of the
+     * field if field-based access is used.
+     * </p>
+     */
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaBasic.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaBasic.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaBasic.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaBasic.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,90 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import javax.persistence.Basic;
+import javax.persistence.FetchType;
+
+public class JpaBasic {
+
+    protected FetchType fetch = FetchType.EAGER;
+    protected boolean optional;
+
+    public JpaBasic() {
+
+    }
+
+    public JpaBasic(Basic basic) {
+        this.fetch = basic.fetch();
+        this.optional = basic.optional();
+    }
+
+    public FetchType getFetch() {
+        return fetch;
+    }
+
+    public void setFetch(FetchType fetchType) {
+        this.fetch = fetchType;
+    }
+
+    public boolean isOptional() {
+        return optional;
+    }
+
+    public void setOptional(boolean optional) {
+        this.optional = optional;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaColumn.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaColumn.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaColumn.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaColumn.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,176 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import javax.persistence.Column;
+
+public class JpaColumn {
+
+    protected String name;
+    protected boolean unique;
+    protected boolean nullable;
+    protected boolean insertable;
+    protected boolean updatable;
+    protected String columnDefinition;
+    protected String table;
+    protected int length;
+    protected int precision;
+    protected int scale;
+
+    public JpaColumn() {
+
+    }
+
+    public JpaColumn(Column annotation) {
+        if (!"".equals(annotation.name())) {
+            name = annotation.name();
+        }
+
+        unique = annotation.unique();
+        nullable = annotation.nullable();
+        insertable = annotation.insertable();
+        updatable = annotation.updatable();
+
+        if (!"".equals(annotation.columnDefinition())) {
+            columnDefinition = annotation.columnDefinition();
+        }
+
+        table = annotation.table();
+        length = annotation.length();
+        precision = annotation.precision();
+        scale = annotation.scale();
+    }
+
+    public String getColumnDefinition() {
+        return columnDefinition;
+    }
+
+    public void setColumnDefinition(String columnDefinition) {
+        this.columnDefinition = columnDefinition;
+    }
+
+    public boolean isInsertable() {
+        return insertable;
+    }
+
+    public void setInsertable(boolean insertable) {
+        this.insertable = insertable;
+    }
+
+    public int getLength() {
+        return length;
+    }
+
+    public void setLength(int length) {
+        this.length = length;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public boolean isNullable() {
+        return nullable;
+    }
+
+    public void setNullable(boolean nullable) {
+        this.nullable = nullable;
+    }
+
+    public int getPrecision() {
+        return precision;
+    }
+
+    public void setPrecision(int precision) {
+        this.precision = precision;
+    }
+
+    public int getScale() {
+        return scale;
+    }
+
+    public void setScale(int scale) {
+        this.scale = scale;
+    }
+
+    public String getTable() {
+        return table;
+    }
+
+    public void setTable(String table) {
+        this.table = table;
+    }
+
+    public boolean isUnique() {
+        return unique;
+    }
+
+    public void setUnique(boolean unique) {
+        this.unique = unique;
+    }
+
+    public boolean isUpdatable() {
+        return updatable;
+    }
+
+    public void setUpdatable(boolean updateable) {
+        this.updatable = updateable;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaColumnResult.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaColumnResult.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaColumnResult.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaColumnResult.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,79 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import javax.persistence.ColumnResult;
+
+public class JpaColumnResult {
+
+    protected String name;
+
+    public JpaColumnResult() {
+
+    }
+
+    public JpaColumnResult(ColumnResult annotation) {
+        name = annotation.name();
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaDiscriminatorColumn.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaDiscriminatorColumn.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaDiscriminatorColumn.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaDiscriminatorColumn.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,110 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.DiscriminatorType;
+
+public class JpaDiscriminatorColumn {
+
+    protected String name;
+    protected DiscriminatorType discriminatorType = DiscriminatorType.STRING;
+    protected String columnDefinition;
+    protected int length;
+
+    public JpaDiscriminatorColumn() {
+
+    }
+
+    public JpaDiscriminatorColumn(DiscriminatorColumn annotation) {
+        name = annotation.name();
+        discriminatorType = annotation.discriminatorType();
+        columnDefinition = annotation.columnDefinition();
+        length = annotation.length();
+    }
+
+    public String getColumnDefinition() {
+        return columnDefinition;
+    }
+
+    public void setColumnDefinition(String columnDefinition) {
+        this.columnDefinition = columnDefinition;
+    }
+
+    public DiscriminatorType getDiscriminatorType() {
+        return discriminatorType;
+    }
+
+    public void setDiscriminatorType(DiscriminatorType discriminatrorType) {
+        this.discriminatorType = discriminatrorType;
+    }
+
+    public int getLength() {
+        return length;
+    }
+
+    public void setLength(int length) {
+        this.length = length;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddable.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddable.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddable.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddable.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,96 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * A descriptor of a persistent class whose instances are stored as an intrinsic part of
+ * an owning entity and share the identity of that entity.
+ * 
+ * @author Andrus Adamchik
+ */
+public class JpaEmbeddable {
+
+    protected String className;
+    protected AccessType access;
+    protected Collection<JpaEmbeddableAttribute> embeddableAttributes;
+
+    public AccessType getAccess() {
+        return access;
+    }
+
+    public void setAccess(AccessType access) {
+        this.access = access;
+    }
+
+    public Collection<JpaEmbeddableAttribute> getEmbeddableAttributes() {
+        if (embeddableAttributes == null) {
+            embeddableAttributes = new ArrayList(5);
+        }
+
+        return embeddableAttributes;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddableAttribute.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddableAttribute.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddableAttribute.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddableAttribute.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,130 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import javax.persistence.EnumType;
+import javax.persistence.TemporalType;
+
+/**
+ * An attribute that belongs to {@link org.objectstyle.cayenne.jpa.map.JpaEmbeddable}.
+ * 
+ * @author Andrus Adamchik
+ */
+public class JpaEmbeddableAttribute {
+
+    protected String name;
+
+    protected boolean lob;
+    protected JpaBasic basic;
+    protected TemporalType temporal;
+    protected JpaColumn column;
+    protected EnumType enumerated;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public JpaBasic getBasic() {
+        return basic;
+    }
+
+    public void setBasic(JpaBasic basic) {
+        this.basic = basic;
+    }
+
+    public JpaColumn getColumn() {
+        return column;
+    }
+
+    public void setColumn(JpaColumn column) {
+        this.column = column;
+    }
+
+    public EnumType getEnumerated() {
+        return enumerated;
+    }
+
+    public void setEnumerated(EnumType enumerated) {
+        this.enumerated = enumerated;
+    }
+
+    public TemporalType getTemporal() {
+        return temporal;
+    }
+
+    public void setTemporal(TemporalType temporal) {
+        this.temporal = temporal;
+    }
+
+    public boolean isLob() {
+        return lob;
+    }
+
+    public void setLob(boolean lob) {
+        this.lob = lob;
+    }
+
+    /**
+     * A special setter used by XML decoder to indicate lob flag presence.
+     */
+    public void setLobTrue(String string) {
+        setLob(true);
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddedId.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddedId.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddedId.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEmbeddedId.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,99 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.objectstyle.cayenne.util.TraversableTreeNode;
+
+public class JpaEmbeddedId implements TraversableTreeNode {
+
+    static final Class[] TRAVERSABLE_CHILDREN = new Class[] {
+        JpaAttributeOverride.class
+    };
+
+    protected String name;
+    protected Collection<JpaAttributeOverride> attributeOverrides;
+
+    public Class[] getTraversableChildTypes() {
+        return TRAVERSABLE_CHILDREN;
+    }
+
+    public Object getTraversableChild(int nodeTypeIndex) {
+        if (nodeTypeIndex == 0) {
+            return attributeOverrides;
+        }
+
+        throw new ArrayIndexOutOfBoundsException(nodeTypeIndex);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Collection<JpaAttributeOverride> getAttributeOverrides() {
+        if (attributeOverrides == null) {
+            attributeOverrides = new ArrayList<JpaAttributeOverride>();
+        }
+
+        return attributeOverrides;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntity.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntity.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntity.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntity.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,245 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * A JPA-compliant entity.
+ * 
+ * @author Andrus Adamchik
+ */
+public class JpaEntity extends JpaAbstractEntity {
+
+    static final Class[] EXTRA_TRAVERSABLE_CHILDREN = new Class[] {
+            JpaTable.class, JpaAttributeOverride.class, JpaNamedQuery.class
+    };
+    static final Class[] TRAVERSABLE_CHILDREN = new Class[JpaAbstractEntity.TRAVERSABLE_CHILDREN.length
+            + EXTRA_TRAVERSABLE_CHILDREN.length];
+
+    static {
+        System.arraycopy(
+                EXTRA_TRAVERSABLE_CHILDREN,
+                0,
+                TRAVERSABLE_CHILDREN,
+                0,
+                EXTRA_TRAVERSABLE_CHILDREN.length);
+
+        System.arraycopy(
+                JpaAbstractEntity.TRAVERSABLE_CHILDREN,
+                0,
+                TRAVERSABLE_CHILDREN,
+                EXTRA_TRAVERSABLE_CHILDREN.length,
+                JpaAbstractEntity.TRAVERSABLE_CHILDREN.length);
+    }
+
+    protected String name;
+    protected JpaTable table;
+    protected JpaInheritance inheritance;
+    protected String discriminatorValue;
+    protected JpaDiscriminatorColumn discriminatorColumn;
+    protected JpaSequenceGenerator sequenceGenerator;
+    protected JpaTableGenerator tableGenerator;
+    protected JpaSqlResultSetMapping sqlResultSetMapping;
+    protected Collection<JpaAttributeOverride> attributeOverrides;
+    protected Collection<JpaNamedQuery> namedQueries;
+    protected Collection<JpaNamedNativeQuery> namedNativeQueries;
+    protected Collection<JpaSecondaryTable> secondaryTables;
+    protected Collection<JpaPrimaryKeyJoinColumn> primaryKeyJoinColumns;
+
+    public Class[] getTraversableChildTypes() {
+        return JpaEntity.TRAVERSABLE_CHILDREN;
+    }
+
+    public Object getTraversableChild(int nodeTypeIndex) {
+
+        switch (nodeTypeIndex) {
+            case 0:
+                return table;
+            case 1:
+                return attributeOverrides;
+            case 2:
+                return namedQueries;
+            default:
+                return super.getTraversableChild(nodeTypeIndex
+                        - EXTRA_TRAVERSABLE_CHILDREN.length);
+        }
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public JpaDiscriminatorColumn getDiscriminatorColumn() {
+        return discriminatorColumn;
+    }
+
+    public void setDiscriminatorColumn(JpaDiscriminatorColumn discriminatorColumn) {
+        this.discriminatorColumn = discriminatorColumn;
+    }
+
+    /**
+     * Returns discriminatorValue property.
+     * <h3>Specification Documentation</h3>
+     * <p>
+     * <b>Description:</b> An optional value that indicates that the row is an entity of
+     * this entity type.
+     * </p>
+     * <p>
+     * <b>Default:</b> If the DiscriminatorValue annotation is not specified, a
+     * provider-specific function to generate a value representing the entity type is used
+     * for the value of the discriminator column. If the DiscriminatorType is STRING, the
+     * discriminator value default is the entity name.
+     * </p>
+     */
+    public String getDiscriminatorValue() {
+        return discriminatorValue;
+    }
+
+    public void setDiscriminatorValue(String discriminatorValue) {
+        this.discriminatorValue = discriminatorValue;
+    }
+
+    public JpaInheritance getInheritance() {
+        return inheritance;
+    }
+
+    public void setInheritance(JpaInheritance inheritance) {
+        this.inheritance = inheritance;
+    }
+
+    public JpaSequenceGenerator getSequenceGenerator() {
+        return sequenceGenerator;
+    }
+
+    public void setSequenceGenerator(JpaSequenceGenerator sequenceGenerator) {
+        this.sequenceGenerator = sequenceGenerator;
+    }
+
+    public JpaSqlResultSetMapping getSqlResultSetMapping() {
+        return sqlResultSetMapping;
+    }
+
+    public void setSqlResultSetMapping(JpaSqlResultSetMapping sqlResultSetMapping) {
+        this.sqlResultSetMapping = sqlResultSetMapping;
+    }
+
+    public JpaTable getTable() {
+        return table;
+    }
+
+    public void setTable(JpaTable table) {
+        this.table = table;
+    }
+
+    public JpaTableGenerator getTableGenerator() {
+        return tableGenerator;
+    }
+
+    public void setTableGenerator(JpaTableGenerator tableGenerator) {
+        this.tableGenerator = tableGenerator;
+    }
+
+    /**
+     * Returns a collection of attribute overrides. Attribute overrides allows to change
+     * the definition of attributes from a mapped superclass.
+     */
+    public Collection<JpaAttributeOverride> getAttributeOverrides() {
+        if (attributeOverrides == null) {
+            attributeOverrides = new ArrayList<JpaAttributeOverride>();
+        }
+
+        return attributeOverrides;
+    }
+
+    public Collection<JpaNamedNativeQuery> getNamedNativeQueries() {
+        if (namedNativeQueries == null) {
+            namedNativeQueries = new ArrayList();
+        }
+        return namedNativeQueries;
+    }
+
+    public Collection<JpaNamedQuery> getNamedQueries() {
+        if (namedQueries == null) {
+            namedQueries = new ArrayList();
+        }
+        return namedQueries;
+    }
+
+    /**
+     * Returns a collection of {@link JpaPrimaryKeyJoinColumn} objects that reference keys
+     * of a primary table. PK join columns used by subclasses in a
+     * {@link javax.persistence.InheritanceType#JOINED} mapping scenario.
+     */
+    public Collection<JpaPrimaryKeyJoinColumn> getPrimaryKeyJoinColumns() {
+        if (primaryKeyJoinColumns == null) {
+            primaryKeyJoinColumns = new ArrayList();
+        }
+        return primaryKeyJoinColumns;
+    }
+
+    public Collection<JpaSecondaryTable> getSecondaryTables() {
+        if (secondaryTables == null) {
+            secondaryTables = new ArrayList();
+        }
+        return secondaryTables;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityListener.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityListener.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityListener.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityListener.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,133 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+
+public class JpaEntityListener {
+
+    protected String className;
+    protected JpaLifecycleCallback prePersist;
+    protected JpaLifecycleCallback postPersist;
+    protected JpaLifecycleCallback preRemove;
+    protected JpaLifecycleCallback postRemove;
+    protected JpaLifecycleCallback preUpdate;
+    protected JpaLifecycleCallback postUpdate;
+    protected JpaLifecycleCallback postLoad;
+
+    public JpaLifecycleCallback getPostLoad() {
+        return postLoad;
+    }
+
+    public void setPostLoad(JpaLifecycleCallback postLoad) {
+        this.postLoad = postLoad;
+    }
+
+    public JpaLifecycleCallback getPostPersist() {
+        return postPersist;
+    }
+
+    public void setPostPersist(JpaLifecycleCallback postPersist) {
+        this.postPersist = postPersist;
+    }
+
+    public JpaLifecycleCallback getPostRemove() {
+        return postRemove;
+    }
+
+    public void setPostRemove(JpaLifecycleCallback postRemove) {
+        this.postRemove = postRemove;
+    }
+
+    public JpaLifecycleCallback getPostUpdate() {
+        return postUpdate;
+    }
+
+    public void setPostUpdate(JpaLifecycleCallback postUpdate) {
+        this.postUpdate = postUpdate;
+    }
+
+    public JpaLifecycleCallback getPrePersist() {
+        return prePersist;
+    }
+
+    public void setPrePersist(JpaLifecycleCallback prePersist) {
+        this.prePersist = prePersist;
+    }
+
+    public JpaLifecycleCallback getPreRemove() {
+        return preRemove;
+    }
+
+    public void setPreRemove(JpaLifecycleCallback preRemove) {
+        this.preRemove = preRemove;
+    }
+
+    public JpaLifecycleCallback getPreUpdate() {
+        return preUpdate;
+    }
+
+    public void setPreUpdate(JpaLifecycleCallback preUpdate) {
+        this.preUpdate = preUpdate;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityListeners.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityListeners.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityListeners.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityListeners.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,78 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * A collection of entity listener descriptors.
+ * 
+ * @author Andrus Adamchik
+ */
+// andrus: I'd rather we flatten this object into JpaEntity, but since we have to follow
+// the schema structure, we need this meaningless object.
+public class JpaEntityListeners {
+
+    protected Collection<JpaEntityListener> entityListeners;
+
+    public Collection<JpaEntityListener> getEntityListeners() {
+        if (entityListeners == null) {
+            entityListeners = new ArrayList<JpaEntityListener>();
+        }
+        return entityListeners;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityMap.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityMap.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityMap.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityMap.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,229 @@
+package org.objectstyle.cayenne.jpa.map;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.CascadeType;
+import javax.persistence.FlushModeType;
+
+import org.objectstyle.cayenne.util.TraversableTreeNode;
+import org.objectstyle.cayenne.validation.ValidationResult;
+
+/**
+ * An object that stores JPA mapping information. This is a root object in the hierarchy
+ * defined in the <em>orm_1_0.xsd</em> schema.
+ * 
+ * @author Andrus Adamchik
+ */
+public class JpaEntityMap implements TraversableTreeNode {
+
+    static final Class[] TRAVERSABLE_CHILDREN = new Class[] {
+            JpaEntity.class, JpaNamedQuery.class
+    };
+
+    // mapped properties
+    protected String packageName;
+    protected String catalog;
+    protected String schema;
+    protected AccessType access;
+    protected FlushModeType flushMode;
+
+    protected Collection<JpaEntity> entities;
+    protected Collection<JpaEmbeddable> embeddables;
+    protected Collection<JpaMappedSuperclass> mappedSuperclasses;
+    protected Collection<JpaNamedQuery> namedQueries;
+    protected Collection<JpaNamedNativeQuery> namedNativeQueries;
+    protected Collection<JpaSqlResultSetMapping> sqlResultSetMappings;
+    protected Collection<JpaSequenceGenerator> sequenceGenerators;
+    protected Collection<JpaTableGenerator> tableGenerators;
+    protected JpaEntityListeners defaultEntityListeners;
+    protected Collection<CascadeType> cascades;
+
+    /**
+     * Merges all entities from another map, overriding existing values.
+     * 
+     * @return An object containing unresolvable conflicts or null if no conflicts
+     *         occured.
+     */
+    public void mergeOverride(JpaEntityMap map) {
+        // TODO: implement
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    /**
+     * Merges all entities from another map.
+     * 
+     * @return An object containing unresolvable conflicts or null if no conflicts
+     *         occured.
+     */
+    public ValidationResult mergeNoOverride(JpaEntityMap map) {
+        // TODO: implement
+        throw new UnsupportedOperationException("TODO");
+    }
+
+    public Class[] getTraversableChildTypes() {
+        return TRAVERSABLE_CHILDREN;
+    }
+
+    public Object getTraversableChild(int nodeTypeIndex) {
+        switch (nodeTypeIndex) {
+            case 0:
+                return entities;
+            case 1:
+                return namedQueries;
+            default:
+                throw new ArrayIndexOutOfBoundsException(nodeTypeIndex);
+        }
+    }
+
+    /**
+     * Returns a JpaEntity describing a given persistent class.
+     */
+    public JpaEntity entityForClass(Class entityClass) {
+
+        if (entityClass == null) {
+            throw new IllegalArgumentException("Null entity class");
+        }
+
+        return entityForClass(entityClass.getName());
+    }
+
+    /**
+     * Returns a JpaEntity describing a given persistent class.
+     */
+    public JpaEntity entityForClass(String entityClassName) {
+        if (entityClassName == null) {
+            throw new IllegalArgumentException("Null entity class name");
+        }
+
+        for (JpaEntity entity : entities) {
+            if (entityClassName.equals(entity.getClassName())) {
+                return entity;
+            }
+        }
+
+        return null;
+    }
+
+    public JpaEntityListeners getDefaultEntityListeners() {
+        return defaultEntityListeners;
+    }
+
+    public void setDefaultEntityListeners(JpaEntityListeners defaultEntityListeners) {
+        this.defaultEntityListeners = defaultEntityListeners;
+    }
+
+    public AccessType getAccess() {
+        return access;
+    }
+
+    public void setAccess(AccessType access) {
+        this.access = access;
+    }
+
+    public String getCatalog() {
+        return catalog;
+    }
+
+    public void setCatalog(String catalog) {
+        this.catalog = catalog;
+    }
+
+    public FlushModeType getFlushMode() {
+        return flushMode;
+    }
+
+    public void setFlushMode(FlushModeType flushMode) {
+        this.flushMode = flushMode;
+    }
+
+    public String getPackageName() {
+        return packageName;
+    }
+
+    public void setPackageName(String packageProperty) {
+        this.packageName = packageProperty;
+    }
+
+    public String getSchema() {
+        return schema;
+    }
+
+    public void setSchema(String schema) {
+        this.schema = schema;
+    }
+
+    public Collection<CascadeType> getCascades() {
+        if (cascades == null) {
+            // TODO: andrus, 4/20/2006 - replace with
+            // ArrayList<CascadeType>() once CAY-520 gets implemented in Cayenne > 1.2
+            cascades = new EnumList(CascadeType.class, CascadeType.values().length);
+        }
+
+        return cascades;
+    }
+
+    public Collection<JpaEmbeddable> getEmbeddables() {
+        if (embeddables == null) {
+            embeddables = new ArrayList<JpaEmbeddable>();
+        }
+
+        return embeddables;
+    }
+
+    public Collection<JpaEntity> getEntities() {
+        if (entities == null) {
+            entities = new ArrayList<JpaEntity>();
+        }
+
+        return entities;
+    }
+
+    public Collection<JpaMappedSuperclass> getMappedSuperclasses() {
+        if (mappedSuperclasses == null) {
+            mappedSuperclasses = new ArrayList<JpaMappedSuperclass>();
+        }
+
+        return mappedSuperclasses;
+    }
+
+    public Collection<JpaNamedNativeQuery> getNamedNativeQueries() {
+        if (namedNativeQueries == null) {
+            namedNativeQueries = new ArrayList<JpaNamedNativeQuery>();
+        }
+
+        return namedNativeQueries;
+    }
+
+    public Collection<JpaNamedQuery> getNamedQueries() {
+        if (namedQueries == null) {
+            namedQueries = new ArrayList<JpaNamedQuery>();
+        }
+
+        return namedQueries;
+    }
+
+    public Collection<JpaSequenceGenerator> getSequenceGenerators() {
+        if (sequenceGenerators == null) {
+            sequenceGenerators = new ArrayList<JpaSequenceGenerator>();
+        }
+
+        return sequenceGenerators;
+    }
+
+    public Collection<JpaSqlResultSetMapping> getSqlResultSetMappings() {
+        if (sqlResultSetMappings == null) {
+            sqlResultSetMappings = new ArrayList<JpaSqlResultSetMapping>();
+        }
+
+        return sqlResultSetMappings;
+    }
+
+    public Collection<JpaTableGenerator> getTableGenerators() {
+        if (tableGenerators == null) {
+            tableGenerators = new ArrayList<JpaTableGenerator>();
+        }
+
+        return tableGenerators;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityResult.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityResult.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityResult.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaEntityResult.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,106 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.persistence.EntityResult;
+
+public class JpaEntityResult {
+
+    protected String entityClassName;
+    protected String discriminatorColumn;
+    protected Collection<JpaFieldResult> fieldResults;
+
+    public JpaEntityResult() {
+
+    }
+
+    public JpaEntityResult(EntityResult annotation) {
+        entityClassName = annotation.entityClass().getName();
+        discriminatorColumn = annotation.discriminatorColumn();
+
+        getFieldResults();
+        for (int i = 0; i < annotation.fields().length; i++) {
+            fieldResults.add(new JpaFieldResult(annotation.fields()[i]));
+        }
+    }
+
+    public Collection<JpaFieldResult> getFieldResults() {
+        if (fieldResults == null) {
+            fieldResults = new ArrayList<JpaFieldResult>();
+        }
+
+        return fieldResults;
+    }
+
+    public String getDiscriminatorColumn() {
+        return discriminatorColumn;
+    }
+
+    public void setDiscriminatorColumn(String descriminatorColumn) {
+        this.discriminatorColumn = descriminatorColumn;
+    }
+
+    public String getEntityClassName() {
+        return entityClassName;
+    }
+
+    public void setEntityClassName(String entityClassName) {
+        this.entityClassName = entityClassName;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaFieldResult.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaFieldResult.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaFieldResult.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaFieldResult.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,89 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import javax.persistence.FieldResult;
+
+public class JpaFieldResult {
+
+    protected String name;
+    protected String column;
+
+    public JpaFieldResult() {
+
+    }
+
+    public JpaFieldResult(FieldResult annoation) {
+        name = annoation.name();
+        column = annoation.column();
+    }
+
+    public String getColumn() {
+        return column;
+    }
+
+    public void setColumn(String column) {
+        this.column = column;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Added: incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaGeneratedValue.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaGeneratedValue.java?rev=396882&view=auto
==============================================================================
--- incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaGeneratedValue.java (added)
+++ incubator/cayenne/trunk/cayenne-jpa/src/main/java/org/objectstyle/cayenne/jpa/map/JpaGeneratedValue.java Tue Apr 25 06:43:00 2006
@@ -0,0 +1,90 @@
+/* ====================================================================
+ * 
+ * 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.map;
+
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+
+public class JpaGeneratedValue {
+
+    protected String generator;
+    protected GenerationType strategy = GenerationType.AUTO;
+
+    public JpaGeneratedValue() {
+
+    }
+
+    public JpaGeneratedValue(GeneratedValue annotation) {
+        this.generator = annotation.generator();
+        this.strategy = annotation.strategy();
+    }
+
+    public String getGenerator() {
+        return generator;
+    }
+
+    public void setGenerator(String generator) {
+        this.generator = generator;
+    }
+
+    public GenerationType getStrategy() {
+        return strategy;
+    }
+
+    public void setStrategy(GenerationType strategy) {
+        this.strategy = strategy;
+    }
+}