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/03 05:38:29 UTC
svn commit: r428219 - in /incubator/cayenne/main/trunk/core/cayenne-jpa/src:
main/java/org/apache/cayenne/jpa/conf/
test/java/org/apache/cayenne/jpa/entity/
Author: aadamchik
Date: Wed Aug 2 20:38:26 2006
New Revision: 428219
URL: http://svn.apache.org/viewvc?rev=428219&view=rev
Log:
annotations tests succeed
Modified:
incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoader.java
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/test/java/org/apache/cayenne/jpa/entity/MockEmbed1.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEntity5.java
incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass3.java
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoader.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoader.java?rev=428219&r1=428218&r2=428219&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoader.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/main/java/org/apache/cayenne/jpa/conf/EntityMapAnnotationLoader.java Wed Aug 2 20:38:26 2006
@@ -32,7 +32,9 @@
import java.util.Map;
import javax.persistence.AssociationOverride;
+import javax.persistence.AssociationOverrides;
import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
@@ -46,6 +48,7 @@
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
+import javax.persistence.MapKey;
import javax.persistence.MappedSuperclass;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
@@ -53,6 +56,7 @@
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
+import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.SqlResultSetMapping;
import javax.persistence.TableGenerator;
@@ -126,14 +130,17 @@
MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(SequenceGenerator.class.getName(), 2);
MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(AttributeOverride.class.getName(), 2);
+ MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(AttributeOverrides.class.getName(), 2);
MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(AssociationOverride.class.getName(), 2);
+ MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(AssociationOverrides.class.getName(), 2);
MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(Lob.class.getName(), 2);
MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(Temporal.class.getName(), 2);
MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(Enumerated.class.getName(), 2);
-
- // third-level
- MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(Column.class.getName(), 3);
+
+ MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(MapKey.class.getName(), 2);
+ MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(OrderBy.class.getName(), 2);
+ MEMBER_ANNOTATION_ORDERING_WEIGHTS.put(Column.class.getName(), 2);
}
protected EntityMapLoaderContext context;
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=428219&r1=428218&r2=428219&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 Wed Aug 2 20:38:26 2006
@@ -21,24 +21,38 @@
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Member;
+import java.util.ArrayList;
+import java.util.Collection;
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
import javax.persistence.Basic;
+import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
+import javax.persistence.JoinColumn;
+import javax.persistence.JoinColumns;
+import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
+import javax.persistence.MapKey;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
+import javax.persistence.OrderBy;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.apache.cayenne.jpa.map.JpaAttribute;
+import org.apache.cayenne.jpa.map.JpaAttributeOverride;
import org.apache.cayenne.jpa.map.JpaBasic;
+import org.apache.cayenne.jpa.map.JpaColumn;
import org.apache.cayenne.jpa.map.JpaEmbedded;
import org.apache.cayenne.jpa.map.JpaEmbeddedId;
import org.apache.cayenne.jpa.map.JpaGeneratedValue;
import org.apache.cayenne.jpa.map.JpaId;
+import org.apache.cayenne.jpa.map.JpaJoinColumn;
+import org.apache.cayenne.jpa.map.JpaJoinTable;
import org.apache.cayenne.jpa.map.JpaManagedClass;
import org.apache.cayenne.jpa.map.JpaManyToMany;
import org.apache.cayenne.jpa.map.JpaManyToOne;
@@ -87,23 +101,21 @@
JpaManagedClass managedClass,
AnnotatedElement element,
AnnotationProcessorStack context) {
- context.recordConflict(element, AnnotationProcessorFactory
- .annotationClass(getClass()), "Unsupported in this place");
+ recordUnsupportedAnnotation(element, context);
}
void onAttribute(
JpaAttribute attribute,
AnnotatedElement element,
AnnotationProcessorStack context) {
- context.recordConflict(element, AnnotationProcessorFactory
- .annotationClass(getClass()), "Unsupported in this place");
+ recordUnsupportedAnnotation(element, context);
}
void recordUnsupportedAnnotation(
AnnotatedElement element,
AnnotationProcessorStack context) {
context.recordConflict(element, AnnotationProcessorFactory
- .annotationClass(getClass()), "Unsupported in this place");
+ .annotationClass(getClass()), "Unsupported in this context");
}
}
@@ -163,70 +175,58 @@
JpaAttribute attribute,
AnnotatedElement element,
AnnotationProcessorStack context) {
- context.recordConflict(element, AnnotationProcessorFactory
- .annotationClass(getClass()), "Unsupported in this place");
+ recordUnsupportedAnnotation(element, context);
}
void recordUnsupportedAnnotation(
AnnotatedElement element,
AnnotationProcessorStack context) {
context.recordConflict(element, AnnotationProcessorFactory
- .annotationClass(getClass()), "Unsupported in this place");
+ .annotationClass(getClass()), "Unsupported in this context");
}
}
- static final class AttributeOverrideProcessor extends L1AnnotationProcessor {
+ static final class AttributeOverrideProcessor extends L2AnnotationProcessor {
- // @Override
- // void onAttribute(
- // JpaAttribute attribute,
- // AnnotatedElement element,
- // AnnotationProcessorStack context) {
- // AttributeOverride annotation =
- // element.getAnnotation(AttributeOverride.class);
- // attribute.getAttributeOverrides().add(new
- // JpaAttributeOverride(annotation));
- // }
- //
- // @Override
- // void onEmbeddedId(
- // JpaEmbeddedId id,
- // AnnotatedElement element,
- // AnnotationProcessorStack context) {
- // AttributeOverride annotation = element.getAnnotation(AttributeOverride.class);
- // id.getAttributeOverrides().add(new JpaAttributeOverride(annotation));
- // }
+ @Override
+ void onAttribute(
+ JpaAttribute attribute,
+ AnnotatedElement element,
+ AnnotationProcessorStack context) {
+
+ if (attribute instanceof JpaEmbeddedId) {
+ JpaAttributeOverride override = new JpaAttributeOverride(element
+ .getAnnotation(AttributeOverride.class));
+ ((JpaEmbeddedId) attribute).getAttributeOverrides().add(override);
+ }
+ else {
+ super.onAttribute(attribute, element, context);
+ }
+ }
}
static final class AttributeOverridesProcessor extends L1AnnotationProcessor {
- // @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(
- // JpaEmbeddedId id,
- // AnnotatedElement element,
- // AnnotationProcessorStack context) {
- // AttributeOverrides annotation = element
- // .getAnnotation(AttributeOverrides.class);
- //
- // for (int i = 0; i < annotation.value().length; i++) {
- // id.getAttributeOverrides().add(
- // new JpaAttributeOverride(annotation.value()[i]));
- // }
- // }
+ @Override
+ void onAttribute(
+ JpaAttribute attribute,
+ AnnotatedElement element,
+ AnnotationProcessorStack context) {
+
+ if (attribute instanceof JpaEmbeddedId) {
+ AttributeOverrides overrides = element
+ .getAnnotation(AttributeOverrides.class);
+
+ for (AttributeOverride overrideAnnotation : overrides.value()) {
+ JpaAttributeOverride override = new JpaAttributeOverride(
+ overrideAnnotation);
+ ((JpaEmbeddedId) attribute).getAttributeOverrides().add(override);
+ }
+ }
+ else {
+ super.onAttribute(attribute, element, context);
+ }
+ }
}
static final class BasicProcessor extends L1AnnotationProcessor {
@@ -263,32 +263,29 @@
}
}
- static final class ColumnProcessor extends L1AnnotationProcessor {
+ static final class ColumnProcessor extends L2AnnotationProcessor {
- // @Override
- // void onAttribute(
- // JpaAttribute attribute,
- // AnnotatedElement element,
- // AnnotationProcessorStack context) {
- // Column annotation = element.getAnnotation(Column.class);
- // attribute.setColumn(new JpaColumn(annotation));
- // }
-
- // @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));
- // }
+ @Override
+ void onAttribute(
+ JpaAttribute attribute,
+ AnnotatedElement element,
+ AnnotationProcessorStack context) {
+
+ JpaColumn column = new JpaColumn(element.getAnnotation(Column.class));
+
+ if (attribute instanceof JpaBasic) {
+ ((JpaBasic) attribute).setColumn(column);
+ }
+ else if (attribute instanceof JpaVersion) {
+ ((JpaVersion) attribute).setColumn(column);
+ }
+ else if (attribute instanceof JpaId) {
+ ((JpaId) attribute).setColumn(column);
+ }
+ else {
+ super.onAttribute(attribute, element, context);
+ }
+ }
}
static final class EmbeddedProcessor extends L1AnnotationProcessor {
@@ -438,43 +435,89 @@
}
}
- static final class JoinColumnProcessor extends L1AnnotationProcessor {
+ static final class JoinColumnProcessor extends L2AnnotationProcessor {
+
+ @Override
+ void onAttribute(
+ JpaAttribute attribute,
+ AnnotatedElement element,
+ AnnotationProcessorStack context) {
+
+ JpaJoinColumn joinColumn = new JpaJoinColumn(element
+ .getAnnotation(JoinColumn.class));
+
+ if (attribute instanceof JpaOneToMany) {
+ ((JpaOneToMany) attribute).getJoinColumns().add(joinColumn);
+ }
+ else if (attribute instanceof JpaOneToOne) {
+ ((JpaOneToOne) attribute).getJoinColumns().add(joinColumn);
+ }
+ else if (attribute instanceof JpaManyToOne) {
+ ((JpaManyToOne) attribute).getJoinColumns().add(joinColumn);
+ }
+ else {
+ super.onAttribute(attribute, element, context);
+ }
+ }
+ }
+
+ static final class JoinColumnsProcessor extends L2AnnotationProcessor {
+
+ @Override
+ void onAttribute(
+ JpaAttribute attribute,
+ AnnotatedElement element,
+ AnnotationProcessorStack context) {
- // @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 L1AnnotationProcessor {
-
- // @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 L1AnnotationProcessor {
-
- // @Override
- // void onAttribute(
- // JpaAttribute attribute,
- // AnnotatedElement element,
- // AnnotationProcessorStack context) {
- // JoinTable annotation = element.getAnnotation(JoinTable.class);
- // attribute.setJoinTable(new JpaJoinTable(annotation));
- // }
+ JoinColumn[] annotations = element.getAnnotation(JoinColumns.class).value();
+ Collection<JpaJoinColumn> joinColumns = new ArrayList<JpaJoinColumn>(
+ annotations.length);
+ for (int i = 0; i < annotations.length; i++) {
+ joinColumns.add(new JpaJoinColumn(annotations[i]));
+ }
+
+ if (attribute instanceof JpaOneToMany) {
+ ((JpaOneToMany) attribute).getJoinColumns().addAll(joinColumns);
+ }
+ else if (attribute instanceof JpaOneToOne) {
+ ((JpaOneToOne) attribute).getJoinColumns().addAll(joinColumns);
+ }
+ else if (attribute instanceof JpaManyToOne) {
+ ((JpaManyToOne) attribute).getJoinColumns().addAll(joinColumns);
+ }
+ else {
+ super.onAttribute(attribute, element, context);
+ }
+ }
+ }
+
+ static final class JoinTableProcessor extends L2AnnotationProcessor {
+
+ @Override
+ void onAttribute(
+ JpaAttribute attribute,
+ AnnotatedElement element,
+ AnnotationProcessorStack context) {
+
+ JpaJoinTable joinTable = new JpaJoinTable(element
+ .getAnnotation(JoinTable.class));
+
+ if (attribute instanceof JpaOneToMany) {
+ ((JpaOneToMany) attribute).setJoinTable(joinTable);
+ }
+ else if (attribute instanceof JpaOneToOne) {
+ ((JpaOneToOne) attribute).setJoinTable(joinTable);
+ }
+ else if (attribute instanceof JpaManyToOne) {
+ ((JpaManyToOne) attribute).setJoinTable(joinTable);
+ }
+ else if (attribute instanceof JpaManyToMany) {
+ ((JpaManyToOne) attribute).setJoinTable(joinTable);
+ }
+ else {
+ super.onAttribute(attribute, element, context);
+ }
+ }
}
static final class LobProcessor extends L2AnnotationProcessor {
@@ -564,16 +607,25 @@
}
}
- static final class MapKeyProcessor extends L1AnnotationProcessor {
+ static final class MapKeyProcessor extends L2AnnotationProcessor {
- // @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) {
+
+ String key = element.getAnnotation(MapKey.class).name();
+ if (attribute instanceof JpaOneToMany) {
+ ((JpaOneToMany) attribute).setMapKey(key);
+ }
+ else if (attribute instanceof JpaManyToMany) {
+ ((JpaManyToMany) attribute).setMapKey(key);
+ }
+ else {
+ super.onAttribute(attribute, element, context);
+ }
+ }
}
static final class OneToManyProcessor extends L1AnnotationProcessor {
@@ -647,14 +699,23 @@
static final class OrderByProcessor extends L1AnnotationProcessor {
- // @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) {
+
+ String order = element.getAnnotation(OrderBy.class).value();
+ if (attribute instanceof JpaOneToMany) {
+ ((JpaOneToMany) attribute).setOrderBy(order);
+ }
+ else if (attribute instanceof JpaManyToMany) {
+ ((JpaManyToMany) attribute).setOrderBy(order);
+ }
+ else {
+ super.onAttribute(attribute, element, context);
+ }
+ }
}
static final class TemporalProcessor extends L2AnnotationProcessor {
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEmbed1.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEmbed1.java?rev=428219&r1=428218&r2=428219&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEmbed1.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEmbed1.java Wed Aug 2 20:38:26 2006
@@ -29,6 +29,7 @@
import javax.persistence.Lob;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import javax.persistence.Transient;
@Embeddable
public class MockEmbed1 {
@@ -40,6 +41,6 @@
@Column(name="column9")
protected String ea1;
- @Basic
+ @Transient
protected String ea2;
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEntity5.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEntity5.java?rev=428219&r1=428218&r2=428219&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEntity5.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockEntity5.java Wed Aug 2 20:38:26 2006
@@ -17,11 +17,8 @@
* under the License.
****************************************************************/
-
package org.apache.cayenne.jpa.entity;
-import javax.persistence.AttributeOverride;
-import javax.persistence.AttributeOverrides;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -55,22 +52,22 @@
protected int attribute2;
@OneToOne(targetEntity = MockTargetEntity1.class, fetch = FetchType.LAZY, optional = true, mappedBy = "mb1", cascade = {
- CascadeType.MERGE, CascadeType.PERSIST
+ CascadeType.REMOVE, CascadeType.REFRESH
})
protected int attribute3;
@OneToMany(targetEntity = MockTargetEntity2.class, fetch = FetchType.LAZY, mappedBy = "mb2", cascade = {
- CascadeType.MERGE, CascadeType.PERSIST
+ CascadeType.PERSIST, CascadeType.MERGE
})
protected int attribute4;
@ManyToOne(targetEntity = MockTargetEntity1.class, fetch = FetchType.LAZY, optional = true, cascade = {
- CascadeType.MERGE, CascadeType.PERSIST
+ CascadeType.PERSIST, CascadeType.MERGE
})
protected int attribute5;
@ManyToMany(targetEntity = MockTargetEntity1.class, fetch = FetchType.LAZY, mappedBy = "mb4", cascade = {
- CascadeType.MERGE, CascadeType.PERSIST
+ CascadeType.PERSIST, CascadeType.MERGE
})
protected int attribute6;
@@ -83,9 +80,11 @@
@Column(name = "column9")
protected int attribute9;
+ @OneToMany
@JoinColumn(name = "join-column-10", referencedColumnName = "x-ref", unique = true, nullable = true, insertable = true, updatable = true, columnDefinition = "x-def", table = "jt1")
protected int attribute10;
+ @OneToMany
@JoinTable(name = "jtable1", catalog = "catalog1", schema = "schema1", joinColumns = {
@JoinColumn(name = "join-column1"), @JoinColumn(name = "join-column2")
}, inverseJoinColumns = {
@@ -107,14 +106,10 @@
protected int attribute14;
@MapKey(name = "mk")
+ @ManyToMany
protected int attribute15;
@OrderBy(value = "x ASC")
+ @ManyToMany
protected int attribute16;
-
- @AttributeOverrides( {
- @AttributeOverride(name = "attribute1", column = @Column(name = "ao_column1")),
- @AttributeOverride(name = "attribute2", column = @Column(name = "ao_column2"))
- })
- protected int attribute17;
}
Modified: incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass3.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass3.java?rev=428219&r1=428218&r2=428219&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass3.java (original)
+++ incubator/cayenne/main/trunk/core/cayenne-jpa/src/test/java/org/apache/cayenne/jpa/entity/MockMappedSuperclass3.java Wed Aug 2 20:38:26 2006
@@ -17,7 +17,6 @@
* under the License.
****************************************************************/
-
package org.apache.cayenne.jpa.entity;
import javax.persistence.Basic;
@@ -45,6 +44,7 @@
@MappedSuperclass
public class MockMappedSuperclass3 {
+
@Basic
protected String attribute1;
@@ -52,22 +52,22 @@
protected int attribute2;
@OneToOne(targetEntity = MockTargetEntity1.class, fetch = FetchType.LAZY, optional = true, mappedBy = "mb1", cascade = {
- CascadeType.MERGE, CascadeType.PERSIST
+ CascadeType.REMOVE, CascadeType.REFRESH
})
protected int attribute3;
@OneToMany(targetEntity = MockTargetEntity2.class, fetch = FetchType.LAZY, mappedBy = "mb2", cascade = {
- CascadeType.MERGE, CascadeType.PERSIST
+ CascadeType.PERSIST, CascadeType.MERGE
})
protected int attribute4;
@ManyToOne(targetEntity = MockTargetEntity1.class, fetch = FetchType.LAZY, optional = true, cascade = {
- CascadeType.MERGE, CascadeType.PERSIST
+ CascadeType.PERSIST, CascadeType.MERGE
})
protected int attribute5;
@ManyToMany(targetEntity = MockTargetEntity1.class, fetch = FetchType.LAZY, mappedBy = "mb4", cascade = {
- CascadeType.MERGE, CascadeType.PERSIST
+ CascadeType.PERSIST, CascadeType.MERGE
})
protected int attribute6;
@@ -80,6 +80,7 @@
@Column(name = "column9")
protected int attribute9;
+ @OneToMany
@JoinColumn(name = "join-column-10", referencedColumnName = "x-ref", unique = true, nullable = true, insertable = true, updatable = true, columnDefinition = "x-def", table = "jt1")
protected int attribute10;
@@ -92,6 +93,7 @@
"pk1"
})
})
+ @OneToMany
protected int attribute11;
@Lob
@@ -103,9 +105,11 @@
@Enumerated(value = EnumType.ORDINAL)
protected int attribute14;
+ @ManyToMany
@MapKey(name = "mk")
protected int attribute15;
@OrderBy(value = "x ASC")
+ @ManyToMany
protected int attribute16;
}