diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedStateManager.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedStateManager.java index 2c6a52f71..b8f48a1ee 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedStateManager.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachedStateManager.java @@ -118,7 +118,7 @@ public class DetachedStateManager // pre-load for efficiency: current field values for restore, dependent // for delete - FieldMetaData[] fields = meta.getFields(); + FieldMetaData[] fields = sm.getMetaData().getFields(); int restore = broker.getRestoreState(); if (_dirty.length() > 0) { BitSet load = new BitSet(fields.length); diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java index d9277e869..61b6046e4 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionAttachStrategy.java @@ -146,7 +146,7 @@ class VersionAttachStrategy int detach = (isNew) ? DETACH_ALL : broker.getDetachState(); FetchConfiguration fetch = broker.getFetchConfiguration(); try { - FieldMetaData[] fmds = meta.getFields(); + FieldMetaData[] fmds = sm.getMetaData().getFields(); for (int i = 0; i < fmds.length; i++) { switch (detach) { case DETACH_ALL: diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddable.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddable.java index 95ac9ec8f..a464fe7f0 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddable.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/embed/TestEmbeddable.java @@ -897,6 +897,13 @@ public class TestEmbeddable extends SingleEMFTestCase { EntityA_Coll_Embed_Embed a = em.find(EntityA_Coll_Embed_Embed.class, ID); checkEntityA_Coll_Embed_Embed(a); + + em.clear(); + em.getTransaction().begin(); + Embed_Embed embed = createEmbed_Embed(em, ID, 100); + a.addEmbed(embed); + em.merge(a); + em.getTransaction().commit(); em.close(); }