You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@PersistenceCapable
public class A
{
B b;
}
@PersistenceCapable(embeddedOnly="true")
public class B
{
Collection<C> elements;
}
@PersistenceCapable
public class C
{
}
so we have tables A and C, with B embedded into table A. The table C would need to have a FK across to table A for "b.elements".
Firstly, with RDBMS, we dont allow this since don't currently handle the "b.elements" as the SCO store to enable use to navigate across the FK, and we don't provide for creation of the FK in C back to A.
We also currently have an assumption that when we retrieve an embedded object that it is fully loaded (all fields). If we allow fields containing non-embedded (persistable) objects then this breaks down. When we do A a = em.find(A.class, id);
if the object is in the L2 cache then it pulls in all fields, since all are present in the L2 cache. If it isn't in the L2 cache then it will pull in the fields loadable in the basic FetchRequest (i.e all except the Collection of C). This is never recovered from since it thinks the field is loaded (StateManager.initForEmbedded). Which in turn populates the L2 cache with an object without the nested Collection etc.
The text was updated successfully, but these errors were encountered:
andyjefferson
changed the title
Support retrieval of embedded objects with collections of non-embedded
Support storage/retrieval of embedded objects with collections of non-embedded persistables
Feb 20, 2022
Take these classes
so we have tables A and C, with B embedded into table A. The table C would need to have a FK across to table A for "b.elements".
Firstly, with RDBMS, we dont allow this since don't currently handle the "b.elements" as the SCO store to enable use to navigate across the FK, and we don't provide for creation of the FK in C back to A.
We also currently have an assumption that when we retrieve an embedded object that it is fully loaded (all fields). If we allow fields containing non-embedded (persistable) objects then this breaks down. When we do
A a = em.find(A.class, id);
if the object is in the L2 cache then it pulls in all fields, since all are present in the L2 cache. If it isn't in the L2 cache then it will pull in the fields loadable in the basic FetchRequest (i.e all except the Collection of C). This is never recovered from since it thinks the field is loaded (StateManager.initForEmbedded). Which in turn populates the L2 cache with an object without the nested Collection etc.
The text was updated successfully, but these errors were encountered: