I think John has the right idea... but since you probably don't need
dynamic form fields, I would probably do it like this:
class MyEntity {
@Id String uid;
@Embedded FormField field1;
@Embedded FormField field2;
...etc
}
(No doubt for Twig you just substitute @Embed for Objectify's
Keep them all in one Entity so you only need to do a single datastore get()
but embed a List of FormField (or something) in the main entity. Both Twig
and Objectify support embedding collections of objects in a single Entity.
Entity size is less important than the number of datastore calls
Hi there,
Unfortunately, I have reached a dead-end, I have a number of entities, for
example:
@Entity
class MyEntity {
@Id
String uid;
String value1;
String value2;
String value3;
...
}
The entity is set by a back-end job with default data. The entity is used to
populate a form
Why not use a single int or long value (depending on the number of
String values) where each bit position determines if that value was
modified? Bit 0 for value1, bit 1 for value2, etc. Then if you want to
know if any of the values have been modified, for example, in a query
then just query to see
Thanks for your suggestion Stephen but it looks error-prone to me, what
happens if in the future I update this entity with more attributes and what
should be the order of the bits? meaning which is first, second, etc. Also,
it would be difficult for other devs to understand and maintained.
--