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/08/02 05:09:36 UTC
svn commit: r427867 - in /incubator/cayenne/main/trunk/core/cayenne-jpa/src:
main/java/org/apache/cayenne/jpa/conf/
main/java/org/apache/cayenne/jpa/map/ main/resources/META-INF/cayenne/
test/java/org/apache/cayenne/jpa/conf/ test/resources/xml-samples/
Author: aadamchik
Date: Tue Aug 1 20:09:35 2006
New Revision: 427867
URL: http://svn.apache.org/viewvc?rev=427867&view=rev
Log:
XML loader tests pass
Removed:
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEmbeddableAttribute.java
Modified:
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAbstractEntity.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEmbeddable.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEntityListener.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaManagedClass.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaMappedSuperclass.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/resources/META-INF/cayenne/orm-coder.xml
incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/MappingAssertion.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/MemberAnnotationProcessorFactory.java Tue Aug 1 20:09:35 2006
@@ -23,19 +23,14 @@
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
-import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
-import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Temporal;
import org.apache.cayenne.jpa.map.JpaAttributeOverride;
import org.apache.cayenne.jpa.map.JpaAttributes;
-import org.apache.cayenne.jpa.map.JpaBasic;
import org.apache.cayenne.jpa.map.JpaColumn;
-import org.apache.cayenne.jpa.map.JpaEmbeddable;
-import org.apache.cayenne.jpa.map.JpaEmbeddableAttribute;
import org.apache.cayenne.jpa.map.JpaEmbeddedId;
import org.apache.cayenne.jpa.map.JpaEntity;
import org.apache.cayenne.jpa.map.JpaGeneratedValue;
@@ -138,19 +133,16 @@
else if (parent instanceof JpaEmbeddedId) {
onEmbeddedId((JpaEmbeddedId) parent, element, context);
}
- else if (parent instanceof JpaEmbeddableAttribute) {
- onEmbeddableAttribute((JpaEmbeddableAttribute) parent, element, context);
- }
- else if (parent instanceof JpaEmbeddable) {
- JpaEmbeddable embeddable = (JpaEmbeddable) parent;
-
- // embeddable attribute implied...
- JpaEmbeddableAttribute attribute = new JpaEmbeddableAttribute();
- embeddable.getEmbeddableAttributes().add(attribute);
- context.push(attribute);
-
- onEmbeddableAttribute(attribute, element, context);
- }
+ // else if (parent instanceof JpaEmbeddable) {
+ // JpaEmbeddable embeddable = (JpaEmbeddable) parent;
+ //
+ // // embeddable attribute implied...
+ // JpaAttributes attributes = new JpaAttributes();
+ // // embeddable.getEmbeddableAttributes().add(attribute);
+ // context.push(attributes);
+ //
+ // // onEmbeddableAttribute(attributes, element, context);
+ // }
}
public void onFinishElement(
@@ -161,9 +153,6 @@
if (stackTop instanceof JpaAttributes) {
context.pop();
}
- else if (stackTop instanceof JpaEmbeddableAttribute) {
- context.pop();
- }
}
void onEmbeddedId(
@@ -177,13 +166,6 @@
recordUnsupportedAnnotation(element, context);
}
- void onEmbeddableAttribute(
- JpaEmbeddableAttribute attribute,
- AnnotatedElement element,
- AnnotationProcessorStack context) {
- recordUnsupportedAnnotation(element, context);
- }
-
void recordUnsupportedAnnotation(
AnnotatedElement element,
AnnotationProcessorStack context) {
@@ -196,14 +178,14 @@
static final class AttributeOverrideProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// AttributeOverride annotation = element.getAnnotation(AttributeOverride.class);
-// attribute.getAttributeOverrides().add(new JpaAttributeOverride(annotation));
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // AttributeOverride annotation = element.getAnnotation(AttributeOverride.class);
+ // attribute.getAttributeOverrides().add(new JpaAttributeOverride(annotation));
+ // }
@Override
void onEmbeddedId(
@@ -217,19 +199,19 @@
static final class AttributeOverridesProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// AttributeOverrides annotation = element
-// .getAnnotation(AttributeOverrides.class);
-//
-// for (int i = 0; i < annotation.value().length; i++) {
-// attribute.getAttributeOverrides().add(
-// new JpaAttributeOverride(annotation.value()[i]));
-// }
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // AttributeOverrides annotation = element
+ // .getAnnotation(AttributeOverrides.class);
+ //
+ // for (int i = 0; i < annotation.value().length; i++) {
+ // attribute.getAttributeOverrides().add(
+ // new JpaAttributeOverride(annotation.value()[i]));
+ // }
+ // }
@Override
void onEmbeddedId(
@@ -248,28 +230,37 @@
static final class BasicProcessor extends AbstractChildProcessor {
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // attribute.setBasic(new JpaBasic(element.getAnnotation(Basic.class)));
+ // }
+
// @Override
-// void onAttribute(
-// JpaAttribute attribute,
+// void onEmbeddableAttribute(
+// JpaEmbeddableAttribute attribute,
// AnnotatedElement element,
// AnnotationProcessorStack context) {
// attribute.setBasic(new JpaBasic(element.getAnnotation(Basic.class)));
// }
-
- @Override
- void onEmbeddableAttribute(
- JpaEmbeddableAttribute attribute,
- AnnotatedElement element,
- AnnotationProcessorStack context) {
- attribute.setBasic(new JpaBasic(element.getAnnotation(Basic.class)));
- }
}
static final class ColumnProcessor extends AbstractChildProcessor {
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // Column annotation = element.getAnnotation(Column.class);
+ // attribute.setColumn(new JpaColumn(annotation));
+ // }
+
// @Override
-// void onAttribute(
-// JpaAttribute attribute,
+// void onEmbeddableAttribute(
+// JpaEmbeddableAttribute attribute,
// AnnotatedElement element,
// AnnotationProcessorStack context) {
// Column annotation = element.getAnnotation(Column.class);
@@ -277,15 +268,6 @@
// }
@Override
- void onEmbeddableAttribute(
- JpaEmbeddableAttribute attribute,
- AnnotatedElement element,
- AnnotationProcessorStack context) {
- Column annotation = element.getAnnotation(Column.class);
- attribute.setColumn(new JpaColumn(annotation));
- }
-
- @Override
void onId(JpaId id, AnnotatedElement element, AnnotationProcessorStack context) {
Column annotation = element.getAnnotation(Column.class);
id.setColumn(new JpaColumn(annotation));
@@ -293,35 +275,35 @@
}
static final class EmbeddedProcessor extends AbstractChildProcessor {
-//
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// attribute.setEmbedded(true);
-// }
+ //
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // attribute.setEmbedded(true);
+ // }
}
static final class EnumeratedProcessor extends AbstractChildProcessor {
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // Enumerated annotation = element.getAnnotation(Enumerated.class);
+ // attribute.setEnumerated(annotation.value());
+ // }
+
// @Override
-// void onAttribute(
-// JpaAttribute attribute,
+// void onEmbeddableAttribute(
+// JpaEmbeddableAttribute attribute,
// AnnotatedElement element,
// AnnotationProcessorStack context) {
// Enumerated annotation = element.getAnnotation(Enumerated.class);
// attribute.setEnumerated(annotation.value());
// }
-
- @Override
- void onEmbeddableAttribute(
- JpaEmbeddableAttribute attribute,
- AnnotatedElement element,
- AnnotationProcessorStack context) {
- Enumerated annotation = element.getAnnotation(Enumerated.class);
- attribute.setEnumerated(annotation.value());
- }
}
static final class GeneratedValueProcessor extends AbstractChildProcessor {
@@ -335,152 +317,152 @@
static final class JoinColumnProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// JoinColumn annotation = element.getAnnotation(JoinColumn.class);
-// attribute.getJoinColumns().add(new JpaJoinColumn(annotation));
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // JoinColumn annotation = element.getAnnotation(JoinColumn.class);
+ // attribute.getJoinColumns().add(new JpaJoinColumn(annotation));
+ // }
}
static final class JoinColumnsProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// JoinColumns annotation = element.getAnnotation(JoinColumns.class);
-//
-// for (int i = 0; i < annotation.value().length; i++) {
-// attribute.getJoinColumns().add(new JpaJoinColumn(annotation.value()[i]));
-// }
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // JoinColumns annotation = element.getAnnotation(JoinColumns.class);
+ //
+ // for (int i = 0; i < annotation.value().length; i++) {
+ // attribute.getJoinColumns().add(new JpaJoinColumn(annotation.value()[i]));
+ // }
+ // }
}
static final class JoinTableProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// JoinTable annotation = element.getAnnotation(JoinTable.class);
-// attribute.setJoinTable(new JpaJoinTable(annotation));
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // JoinTable annotation = element.getAnnotation(JoinTable.class);
+ // attribute.setJoinTable(new JpaJoinTable(annotation));
+ // }
}
static final class LobProcessor extends AbstractChildProcessor {
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // attribute.setLob(true);
+ // }
+
// @Override
-// void onAttribute(
-// JpaAttribute attribute,
+// void onEmbeddableAttribute(
+// JpaEmbeddableAttribute attribute,
// AnnotatedElement element,
// AnnotationProcessorStack context) {
// attribute.setLob(true);
// }
-
- @Override
- void onEmbeddableAttribute(
- JpaEmbeddableAttribute attribute,
- AnnotatedElement element,
- AnnotationProcessorStack context) {
- attribute.setLob(true);
- }
}
static final class ManyToManyProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// ManyToMany annotation = element.getAnnotation(ManyToMany.class);
-// attribute.setManyToMany(new JpaManyToMany(annotation));
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // ManyToMany annotation = element.getAnnotation(ManyToMany.class);
+ // attribute.setManyToMany(new JpaManyToMany(annotation));
+ // }
}
static final class ManyToOneProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// attribute.setManyToOne(new JpaManyToOne(element
-// .getAnnotation(ManyToOne.class)));
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // attribute.setManyToOne(new JpaManyToOne(element
+ // .getAnnotation(ManyToOne.class)));
+ // }
}
static final class MapKeyProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// MapKey annotation = element.getAnnotation(MapKey.class);
-// attribute.setMapKey(annotation.name());
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // MapKey annotation = element.getAnnotation(MapKey.class);
+ // attribute.setMapKey(annotation.name());
+ // }
}
static final class OneToManyProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// attribute.setOneToMany(new JpaOneToMany(element
-// .getAnnotation(OneToMany.class)));
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // attribute.setOneToMany(new JpaOneToMany(element
+ // .getAnnotation(OneToMany.class)));
+ // }
}
static final class OneToOneProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// attribute.setOneToOne(new JpaOneToOne(element.getAnnotation(OneToOne.class)));
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // attribute.setOneToOne(new JpaOneToOne(element.getAnnotation(OneToOne.class)));
+ // }
}
static final class OrderByProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// OrderBy annotation = element.getAnnotation(OrderBy.class);
-// attribute.setOrderBy(annotation.value());
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // OrderBy annotation = element.getAnnotation(OrderBy.class);
+ // attribute.setOrderBy(annotation.value());
+ // }
}
static final class TemporalProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// Temporal annotation = element.getAnnotation(Temporal.class);
-// attribute.setTemporal(annotation.value());
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // Temporal annotation = element.getAnnotation(Temporal.class);
+ // attribute.setTemporal(annotation.value());
+ // }
- @Override
- void onEmbeddableAttribute(
- JpaEmbeddableAttribute attribute,
- AnnotatedElement element,
- AnnotationProcessorStack context) {
- Temporal annotation = element.getAnnotation(Temporal.class);
- attribute.setTemporal(annotation.value());
- }
+ // @Override
+ // void onEmbeddableAttribute(
+ // JpaEmbeddableAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // Temporal annotation = element.getAnnotation(Temporal.class);
+ // attribute.setTemporal(annotation.value());
+ // }
@Override
void onId(JpaId id, AnnotatedElement element, AnnotationProcessorStack context) {
@@ -491,13 +473,13 @@
static final class TransientProcessor extends AbstractChildProcessor {
-// @Override
-// void onAttribute(
-// JpaAttribute attribute,
-// AnnotatedElement element,
-// AnnotationProcessorStack context) {
-// attribute.setTransient(true);
-// }
+ // @Override
+ // void onAttribute(
+ // JpaAttribute attribute,
+ // AnnotatedElement element,
+ // AnnotationProcessorStack context) {
+ // attribute.setTransient(true);
+ // }
}
static final class VersionProcessor extends AbstractChildProcessor {
@@ -508,6 +490,6 @@
// AnnotatedElement element,
// AnnotationProcessorStack context) {
// attribute.setVersion(true);
- // }
+ // }
}
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAbstractEntity.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAbstractEntity.java?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAbstractEntity.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAbstractEntity.java Tue Aug 1 20:09:35 2006
@@ -35,8 +35,6 @@
protected JpaLifecycleCallback postUpdate;
protected JpaLifecycleCallback postLoad;
- protected JpaAttributes attributes;
-
@TreeNodeChild
public JpaEntityListeners getEntityListeners() {
return entityListeners;
@@ -69,7 +67,7 @@
public void setExcludeSuperclassListeners(boolean excludeSuperclassListeners) {
this.excludeSuperclassListeners = excludeSuperclassListeners;
}
-
+
/**
* A setter used for XML serialization purposes that internally calls
* <em>setExcludeSuperclassListeners(true)</em>.
@@ -140,16 +138,5 @@
public void setPreUpdate(JpaLifecycleCallback preUpdate) {
this.preUpdate = preUpdate;
- }
-
- public JpaAttributes getAttributes() {
- if (attributes == null) {
- attributes = new JpaAttributes();
- }
- return attributes;
- }
-
- public void setAttributes(JpaAttributes attributes) {
- this.attributes = attributes;
}
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaAttributes.java Tue Aug 1 20:09:35 2006
@@ -245,6 +245,25 @@
}
return transientAttributes;
}
+
+ /**
+ * Returns a JpaTransient for a given property name
+ */
+ public JpaTransient getTransientAttribute(String attributeName) {
+ if (attributeName == null) {
+ throw new IllegalArgumentException("Null attribute name");
+ }
+
+ if (transientAttributes != null) {
+ for (JpaTransient attribute : transientAttributes) {
+ if (attributeName.equals(attribute.getName())) {
+ return attribute;
+ }
+ }
+ }
+
+ return null;
+ }
public Collection<JpaVersion> getVersionAttributes() {
if (versionAttributes == null) {
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEmbeddable.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEmbeddable.java?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEmbeddable.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEmbeddable.java Tue Aug 1 20:09:35 2006
@@ -17,13 +17,8 @@
* under the License.
****************************************************************/
-
package org.apache.cayenne.jpa.map;
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.cayenne.util.TreeNodeChild;
/**
* A descriptor of a persistent class whose instances are stored as an intrinsic part of
@@ -33,14 +28,4 @@
*/
public class JpaEmbeddable extends JpaManagedClass {
- protected Collection<JpaEmbeddableAttribute> embeddableAttributes;
-
- @TreeNodeChild(type = JpaEmbeddableAttribute.class)
- public Collection<JpaEmbeddableAttribute> getEmbeddableAttributes() {
- if (embeddableAttributes == null) {
- embeddableAttributes = new ArrayList(5);
- }
-
- return embeddableAttributes;
- }
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEntityListener.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEntityListener.java?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEntityListener.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaEntityListener.java Tue Aug 1 20:09:35 2006
@@ -94,4 +94,9 @@
public void setClassName(String className) {
this.className = className;
}
+
+ @Override
+ public String toString() {
+ return "JpaEntityListener:" + className;
+ }
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaManagedClass.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaManagedClass.java?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaManagedClass.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaManagedClass.java Tue Aug 1 20:09:35 2006
@@ -28,6 +28,8 @@
protected boolean metadataComplete;
protected String description;
+ protected JpaAttributes attributes;
+
public JpaClassDescriptor getClassDescriptor() {
return classDescriptor;
}
@@ -66,5 +68,16 @@
public void setDescription(String description) {
this.description = description;
+ }
+
+ public JpaAttributes getAttributes() {
+ if (attributes == null) {
+ attributes = new JpaAttributes();
+ }
+ return attributes;
+ }
+
+ public void setAttributes(JpaAttributes attributes) {
+ this.attributes = attributes;
}
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaMappedSuperclass.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaMappedSuperclass.java?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaMappedSuperclass.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/map/JpaMappedSuperclass.java Tue Aug 1 20:09:35 2006
@@ -17,23 +17,8 @@
* under the License.
****************************************************************/
-
package org.apache.cayenne.jpa.map;
public class JpaMappedSuperclass extends JpaAbstractEntity {
- /**
- * Returns a guranateed non-null JpaEntityListeners instance owned by this mapped
- * superclass.
- */
- // note that per orm_1_0.xsd, mapped superclass can have only a single listener which
- // seems to be an error in the spec, while annotations allow setting multiple
- // listeners
- public JpaEntityListeners getEntityListeners() {
- if (entityListeners == null) {
- entityListeners = new JpaEntityListeners();
- }
-
- return entityListeners;
- }
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/resources/META-INF/cayenne/orm-coder.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/resources/META-INF/cayenne/orm-coder.xml?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/resources/META-INF/cayenne/orm-coder.xml (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/resources/META-INF/cayenne/orm-coder.xml Tue Aug 1 20:09:35 2006
@@ -126,17 +126,7 @@
<property name="access" xmlTag="access" attribute="YES"/>
<property name="metadataComplete" xmlTag="metadata-complete" attribute="YES"/>
- <property name="embeddableAttributes" xmlTag="embeddable-attribute"/>
- </entity>
-
- <entity name="org.apache.cayenne.jpa.map.JpaEmbeddableAttribute" xmlTag="embeddable-attribute">
- <property name="basic" xmlTag="basic"/>
- <property name="lobTrue" xmlTag="lob"/>
- <property name="temporal" xmlTag="temporal"/>
- <property name="enumerated" xmlTag="enumerated"/>
- <property name="column" xmlTag="column"/>
-
- <property name="name" xmlTag="name" attribute="YES"/>
+ <property name="attributes" xmlTag="attributes"/>
</entity>
<entity name="org.apache.cayenne.jpa.map.JpaEntity" xmlTag="entity">
@@ -301,7 +291,7 @@
<property name="idClass" xmlTag="id-class"/>
<property name="excludeDefaultListenersTrue" xmlTag="exclude-default-listeners"/>
<property name="excludeSuperclassListenersTrue" xmlTag="exclude-superclass-listeners"/>
- <property name="entityListeners.entityListeners" xmlTag="entity-listener"/>
+ <property name="entityListeners" xmlTag="entity-listeners"/>
<property name="prePersist" xmlTag="pre-persist"/>
<property name="postPersist" xmlTag="post-persist"/>
<property name="preRemove" xmlTag="pre-remove"/>
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/MappingAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/MappingAssertion.java?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/MappingAssertion.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/conf/MappingAssertion.java Tue Aug 1 20:09:35 2006
@@ -26,7 +26,6 @@
import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorType;
-import javax.persistence.EnumType;
import javax.persistence.FetchType;
import javax.persistence.GenerationType;
import javax.persistence.InheritanceType;
@@ -40,7 +39,6 @@
import org.apache.cayenne.jpa.map.JpaColumn;
import org.apache.cayenne.jpa.map.JpaColumnResult;
import org.apache.cayenne.jpa.map.JpaEmbeddable;
-import org.apache.cayenne.jpa.map.JpaEmbeddableAttribute;
import org.apache.cayenne.jpa.map.JpaEmbeddedId;
import org.apache.cayenne.jpa.map.JpaEntity;
import org.apache.cayenne.jpa.map.JpaEntityListener;
@@ -62,6 +60,7 @@
import org.apache.cayenne.jpa.map.JpaSqlResultSetMapping;
import org.apache.cayenne.jpa.map.JpaTable;
import org.apache.cayenne.jpa.map.JpaTableGenerator;
+import org.apache.cayenne.jpa.map.JpaTransient;
import org.apache.cayenne.jpa.map.JpaUniqueConstraint;
import org.apache.cayenne.jpa.map.JpaVersion;
@@ -123,26 +122,23 @@
assertEquals("org.apache.cayenne.jpa.entity.MockEmbed1", embeddable1
.getClassName());
- assertEquals(2, embeddable1.getEmbeddableAttributes().size());
- Iterator<JpaEmbeddableAttribute> it = embeddable1
- .getEmbeddableAttributes()
- .iterator();
- JpaEmbeddableAttribute a1 = it.next();
+ JpaAttributes attributes = embeddable1.getAttributes();
+ assertNotNull(attributes);
+ assertEquals(2, attributes.size());
+ assertEquals(1, attributes.getBasicAttributes().size());
+ JpaBasic a1 = attributes.getBasicAttribute("ea1");
assertEquals("ea1", a1.getName());
- assertNotNull(a1.getBasic());
- assertTrue(a1.getBasic().isOptional());
- assertSame(FetchType.EAGER, a1.getBasic().getFetch());
+ assertTrue(a1.isOptional());
+ assertSame(FetchType.EAGER, a1.getFetch());
assertTrue(a1.isLob());
- assertEquals(TemporalType.DATE, a1.getTemporal());
- assertEquals(EnumType.ORDINAL, a1.getEnumerated());
assertNotNull(a1.getColumn());
assertEquals("column9", a1.getColumn().getName());
- JpaEmbeddableAttribute a2 = it.next();
+ assertEquals(1, attributes.getTransientAttributes().size());
+ JpaTransient a2 = attributes.getTransientAttribute("ea2");
assertEquals("ea2", a2.getName());
- assertFalse(a2.isLob());
}
protected void assertEntity1(JpaEntity entity1) {
@@ -566,7 +562,7 @@
protected void assertMappedSuperclass3(JpaMappedSuperclass mappedSuperclass3) {
assertNotNull(mappedSuperclass3.getAttributes());
- assertEquals(17, mappedSuperclass3.getAttributes().size());
+ assertEquals(16, mappedSuperclass3.getAttributes().size());
assertAttributes(mappedSuperclass3.getAttributes());
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml?rev=427867&r1=427866&r2=427867&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml Tue Aug 1 20:09:35 2006
@@ -132,7 +132,7 @@
<post-load method-name="epostLoad"/>
</mapped-superclass>
- <!-- EMBEDDED Id -->
+ <!-- MAPPED SUPERCLASS WITH EMBEDDED Id -->
<mapped-superclass class="org.apache.cayenne.jpa.entity.MockMappedSuperclass2">
<attributes>
<embedded-id name="embeddedId">
@@ -215,8 +215,8 @@
<one-to-one name="attribute3" target-entity="org.apache.cayenne.jpa.entity.MockTargetEntity1"
fetch="LAZY" optional="true" mapped-by="mb1">
<cascade>
- <cascade-persist/>
- <cascade-merge/>
+ <cascade-remove/>
+ <cascade-refresh/>
</cascade>
</one-to-one>