From 2e5a6e447884e01d772410f9e47949b6cd6c4694 Mon Sep 17 00:00:00 2001 From: Jeremy Bauer Date: Wed, 18 Mar 2009 04:01:14 +0000 Subject: [PATCH] OPENJPA-885 Committing code and tests contributed by Dianne Richards. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@755469 13f79535-47bb-0310-9956-ffa450edef68 --- .../persistence/AnnotationPersistenceMetaDataSerializer.java | 5 ++++- .../org/apache/openjpa/persistence/EntityManagerImpl.java | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java index 66d1330ad..1a1a5d7b1 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java @@ -1012,7 +1012,10 @@ public class AnnotationPersistenceMetaDataSerializer if (vmd.getCascadeRefresh() == ValueMetaData.CASCADE_IMMEDIATE) { cascades.add(CascadeType.REFRESH); } - if (cascades.size() == 4) // ALL + if (vmd.getCascadeDetach() == ValueMetaData.CASCADE_IMMEDIATE) { + cascades.add(CascadeType.CLEAR); + } + if (cascades.size() == 5) // ALL { cascades.clear(); cascades.add(CascadeType.ALL); diff --git a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java index 30c360ebe..92a23aad7 100644 --- a/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java +++ b/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java @@ -1475,6 +1475,7 @@ public class EntityManagerImpl } public void clear(Object entity) { + assertNotCloseInvoked(); _broker.detach(entity, this); }