objectify

objectify query filter by list in entity contains search parameter

谁说胖子不能爱 提交于 2019-12-04 05:27:38
in an app i have an entity that contains a list of other entities (let's say an event holding a list of assigned employees) using objectify - i need to find all the events a particular employee is assigned to. is there a basic way to filter a query if it contains the parameter - kind of the opposite of the query in ... quick pseudocode findAll(Employee employee) { ... return ofy.query(Event.class).filter("employees.contains", employee).list(); } any help would be greatly appreciated i tried just doing filter("employees", employee) after seeing this http://groups.google.com/group/objectify

How do you implement cascading delete in Objectify?

允我心安 提交于 2019-12-04 05:13:46
I have the following heriacy. GrandParent --> Parent --> Child Parent and Child use @Parent Ref<GrandParent> and @Parent Ref<Parent> to create there parent relationship. I am trying to come of with a good way to do a cascading delete for GrandParent . I of course I could load all the children, generate keys from them and delete by key. This seems terribly inefficient. Is there something where I could query by parent and turn the query results into a list of keys without having to do the full fetch? Any thoughts, or third party libraries welcome. Basically, what Michael said, but here is the

Is it possible to have a computed property on Google App Engine using Java?

廉价感情. 提交于 2019-12-03 23:07:21
问题 I have an app engine application and I want to run a query that sorts the result based on a expression involving two properties. Best way I thought of doing it so far is to create a computed/calculated property that stores the result of that expression. Although I saw that GAE in Python offers a ComputedProperty, which seems to be exactly what I'm looking for, I couldn't find an equivalent in Java. I'm currently using Objectify too, if that helps. Any ideas? 回答1: Compute your value in an

How to sort responses in Objectify?

随声附和 提交于 2019-12-03 16:21:18
问题 I'm currently building an app for deployment to GAE, using Objectify 3.1. I am getting strange results when attempting to do a query with an order() clause. My domain: public class InvoiceLineItem { private int units; private BigDecimal unitCost; private BigDecimal extendedCost; private String description; @Parent Key<Invoice> invoice; } I am attempting to gather all of the InvoiceLineItems associated with a given Invoice using the following: ofy ().query (InvoiceLineItem.class).ancestor

Stripping python namespace attributes from an lxml.objectify.ObjectifiedElement [duplicate]

人走茶凉 提交于 2019-12-03 14:29:13
Possible Duplicate: When using lxml, can the XML be rendered without namespace attributes? How can I strip the python attributes from an lxml.objectify.ObjectifiedElement ? Example: In [1]: from lxml import etree, objectify In [2]: foo = objectify.Element("foo") In [3]: foo.bar = "hi" In [4]: foo.baz = 1 In [5]: foo.fritz = None In [6]: print etree.tostring(foo, pretty_print=True) <foo xmlns:py="http://codespeak.net/lxml/objectify/pytype" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" py:pytype="TREE"> <bar py:pytype="str">hi</bar> <baz py

Objectify Relationships: One-to-Many, Can I do this efficiently?

江枫思渺然 提交于 2019-12-03 14:04:38
问题 I'm fairly new to Objectify, and I had a quick question for the best way to do something: Lets say I have an application that allows people to send and receive messages (think e-mail for simplicity). When my app loads, I don't want to load every single message from every single contact that's sent a message to a given user. That would be a waste. Instead, I want to load all of the contacts that a user has messages from (read or unread) so that I can display a list of the contacts on my app,

Objectify loads object behind Ref<?> even when @Load is not specified

╄→гoц情女王★ 提交于 2019-12-03 13:41:02
问题 I have an account object which references a user object. @Cache @Entity public final class Account { @Id Long id; @Index private Ref<User> user; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public User getUser() { return user.get(); } public void setUser(User user) { this.user = Ref.create(user); } } I have hidden the Ref as recommended here: http://code.google.com/p/objectify-appengine/wiki/Entities - please note the Ref does not have the @Load annotation.

Why .now()? (Objectify)

余生颓废 提交于 2019-12-03 13:33:54
问题 Why would I ever want to load an Objectify entity asynchronously? And what does asynchronous loading actually mean? According to Objectify documentation about loading, the following way of loading an Entity is asynchronous: // Simple key fetch, always asynchronous Result<Thing> th = ofy().load().key(thingKey); And if I want a load to perform synchronously then I should do this: Thing th = ofy().load().key(thingKey).now(); // added .now() To me, asynchronous means that the action will take

Python Lxml (objectify): Checking whether a tag exists

人盡茶涼 提交于 2019-12-03 07:54:19
问题 I need to check whether a certain tag exists in an xml file. For example, I want to see if the tag exists in this snippet: <main> <elem1/> <elem2>Hi</elem2> <elem3/> ... </main> Currently, I am using an ugly hack with error checking, like this: try: if root.elem1.tag: foo = elem1 except AttributeError: foo = "error finding elem1" I also want to customize the string if it is unable to find the node (i.e. "unable to find -tagname-"). I have to check a long list of variables, and I don't want to

How to sort responses in Objectify?

醉酒当歌 提交于 2019-12-03 05:40:59
I'm currently building an app for deployment to GAE, using Objectify 3.1. I am getting strange results when attempting to do a query with an order() clause. My domain: public class InvoiceLineItem { private int units; private BigDecimal unitCost; private BigDecimal extendedCost; private String description; @Parent Key<Invoice> invoice; } I am attempting to gather all of the InvoiceLineItems associated with a given Invoice using the following: ofy ().query (InvoiceLineItem.class).ancestor (invoiceKey).list ( ); In my test case, this works just fine, returning 2 rows as expected. However, when I