How many of each will you have? You need to remember that nearly all of the
costs in the datastore are per-operation charges so you need to allow for
that. For example, if you have relatively few clients / vendors you could
list them all in a single entity. (You have a 1MB limit per entity) You
might then store invoices on a second entity and put all of the product
data on the invoice - it depends on how you use products outside of the
information given. So... try this for a medium sized app

This is Objectify syntax - Objectify will put the below into two datastore
entities for you and even load other entities automatically if you want it
to - such as automatically loading the Client (and vendor which is embedded
into the Client) when you load an Invoice (along with the Products that are
embedded into the Invoice in my example).

public class Vendor
{
   String name;
   ...
}

@Entity
public class Client
{
  @Id
  String name;
  @Embed
  List<Vendor> vendorAccessList;
  List<Invoice> invoiceList;
  ...
}

@Entity
public class Invoice
{
  @Id
  Long id;
  Client for;
  @Embed
  List<Product> productList;
  List<Integer> quantityList;
  BigDecimal totalPrice;
  BigDecimal tax;
  ...
}

public class Product
{
   String name;
   String description;
   BigDecimal price;
   ...
}


This schema isn't great for all purposes but might work for you, who knows.

Good:
  When you load an invoice, you can get all of the product data, in one
datastore "get".
  When you load an invoice, you can automatically load all the Client /
Vendor information in a second "get".

Bad:
  It takes a query to find all of the Clients a Vendor can access.
  Product data will be repeated when you sell the same product to another
client - and products can't exist without being attached to an invoice.
  A really big invoice might break the 1MB rule because all the product
data is stored in the same entity.


On 30 January 2012 13:14, guillaume.brus...@gmail.com <
guillaume.brus...@gmail.com> wrote:

> Small project design
>
> Hello I have got a typical project project
> vendors<->clients<->invoice<-> product
> and I would like to use the best design for better performance
>
> a) one or many vendros can access one client
>
> c) a client has one or many invoice
>
> d) invoice reffer to product
>
> I am a little bit afraid by performance for retrieving information
>
> I was thinking on creating cross references
>
>
> Vendor
> - name
> - client list
>
> Client
> - name
> - vendor list
> - invoice list
>
> Invoice
> - Number
> - ?Client ref?
>
> what do you think of that structure ?
>
> Regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-java@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to