surinder-insonix / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

Support embedded Collections #258

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
With a datastore like GAE has, being able to pull in all data in one call is 
desirable. With that in mind it ought to be possible to allow persistence of 
embedded collections (into the owning object). For example

public class Order
{
    String id;

    @Embedded
    Collection<OrderItem> items;
}

@EmbeddedOnly
public class OrderItem
{
    String name;
    double price;
}

so the Entity for an Order with embedded OrderItems would have properties like
ID
ITEMS_LENGTH
ITEMS_1_NAME
ITEMS_1_PRICE
ITEMS_2_NAME
ITEMS_2_PRICE

and then on reading it can find all properties ITEMS_XXX and load up the 
(embedded) Collection.

Original issue reported on code.google.com by googleco...@yahoo.co.uk on 5 Jan 2012 at 9:18

GoogleCodeExporter commented 8 years ago

Original comment by googleco...@yahoo.co.uk on 3 May 2012 at 6:23

GoogleCodeExporter commented 8 years ago
SVN trunk now supports persistence of embedded collections. Doesn't yet support 
inherited elements, but that is only in JDO3.1 and not in JPA - to be provided 
in later issue. Doesn't provide any query capability of embedded collections 
yet (other than basic retrieval)

Original comment by googleco...@yahoo.co.uk on 3 Jun 2012 at 2:52

GoogleCodeExporter commented 8 years ago
Naming in SVN is as follows
{fieldName}.size
NAME.0
PRICE.0
NAME.1
PRICE.1

so the user can set the basic name of each field of the embedded element, and 
it gains a suffix ".{index}"

Original comment by googleco...@yahoo.co.uk on 3 Jun 2012 at 6:12