Hello Drew,
I don't know much about GWT, but what I think you need to create a new
object to handle this data, like a wrapper that should have all the
information you need (number, consumption, supplier name) or @Transient
properties into the entity object.
So you need to get the suppliers from the datastore and it should be a batch
get.
Sample using objectify + fluent-java:
List<Supply> supplies = ofy.query(Supply.class).list();
List<Key<Supplier>> suppliers =
FluentUtils.fromList(supplies).map(getter("supplier"));
Map<Key<Supplier>, Supplier> suppliersMap = ofy.get(suppliers);
// suppose you have a @Transient property called supplierName
for (Supply s : supplies)
s.setSupplierName(suppliersMap.get(s.getSupplier)).getName());
On Tue, Jun 28, 2011 at 10:55 AM, Drew Spencer <[email protected]>wrote:
> Hey coders, wasn't sure whether to put this in the objectify group or here,
> so I went for here.
>
> I have a many-to-one relationship that is causing me a headache. I am using
> a CellTable to display the data for this entity:
>
> class Supply
> {
> @Id private Long id;
> private String number;
> private String consumption;
> private Key<Supplier> supplier;
> }
>
> I am using an RPC call to grab the ArrayList of supplies and then display
> the number and consumption in the columns of the CellTable. I also however,
> want to display the name of the Supplier. As I understand it, a CellTable
> displays data from a single entity, so I would have to make another property
> in my Supply class to do this? Is this right?
>
> I am using GWT and the MVP architecture from here:
> http://code.google.com/webtoolkit/articles/mvp-architecture.html
>
> Thanks for any help you can provide.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine-java/-/4IGNBRobfuUJ.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
--
Bruno Fuster
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.