OPENJPA-1226: fix merge entities with nested embeddables

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@801052 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Fay Wang 2009-08-05 02:56:41 +00:00
parent baaec8148b
commit a4a94f5331
3 changed files with 9 additions and 2 deletions

View File

@ -118,7 +118,7 @@ public class DetachedStateManager
// pre-load for efficiency: current field values for restore, dependent // pre-load for efficiency: current field values for restore, dependent
// for delete // for delete
FieldMetaData[] fields = meta.getFields(); FieldMetaData[] fields = sm.getMetaData().getFields();
int restore = broker.getRestoreState(); int restore = broker.getRestoreState();
if (_dirty.length() > 0) { if (_dirty.length() > 0) {
BitSet load = new BitSet(fields.length); BitSet load = new BitSet(fields.length);

View File

@ -146,7 +146,7 @@ class VersionAttachStrategy
int detach = (isNew) ? DETACH_ALL : broker.getDetachState(); int detach = (isNew) ? DETACH_ALL : broker.getDetachState();
FetchConfiguration fetch = broker.getFetchConfiguration(); FetchConfiguration fetch = broker.getFetchConfiguration();
try { try {
FieldMetaData[] fmds = meta.getFields(); FieldMetaData[] fmds = sm.getMetaData().getFields();
for (int i = 0; i < fmds.length; i++) { for (int i = 0; i < fmds.length; i++) {
switch (detach) { switch (detach) {
case DETACH_ALL: case DETACH_ALL:

View File

@ -897,6 +897,13 @@ public class TestEmbeddable extends SingleEMFTestCase {
EntityA_Coll_Embed_Embed a = EntityA_Coll_Embed_Embed a =
em.find(EntityA_Coll_Embed_Embed.class, ID); em.find(EntityA_Coll_Embed_Embed.class, ID);
checkEntityA_Coll_Embed_Embed(a); 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(); em.close();
} }