Pouton Gerald
Pouton Gerald

Reputation: 1625

query datastore entity by list property in java

I have a data model where one of the properties is a List<String> called tags.

For context:

Say I am working on a free for all blog where writers are allowed to tag their posts (basically twitter et all). For example an entry may be an article about the president and the tags may be:

tag={politics, family, social, news, economy}

Notice that the tags are not predefined and that a writer adds them at whim/will.

Question:

I am using JPA with the app-engine datastore through the GAE-Eclipse-Plugin. What query would I use to search for all entries with a certain tag? Say I want all entries with the tags {movies, family}. I am looking for either JPA or DatastoreService based answers.

NOTE: The equivalent in the Python version of the app-engine-datastore is shown here under List. But the queries are GQL. How would JPA do it since to my knowledge there is no direct GQL for Java yet.

results = db.GqlQuery("SELECT * FROM MyModel WHERE numbers < 10")

Upvotes: 1

Views: 357

Answers (0)

Related Questions