Did you try WHERE p.user = KEY('User', 2102191) ? That's how it works on the
admin console with raw queries...
I'm just not sure 'cause I'm using objectify for all apps...
filter("p.user", user.key()) is enough :)
On Tue, Jun 28, 2011 at 6:14 PM, hadf <[email protected]> wrote:
> Hello,
>
> I have two beans that are associated :
>
> @Entity
> public class User {
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY)
> private Key key;
>
> [...]
> }
>
> @Entity
> public class Profil {
> @Id
> @GeneratedValue(strategy=GenerationType.IDENTITY)
> private Key key;
>
> private Key user;
>
> [...]
> }
>
>
>
> I want to select a Profil by the user key :
>
> User userBean = dao.getUser();
> Query query = em.query("SELECT p FROM Profil p WHERE p.user = " +
> userBean.getKey())
>
>
>
> But my query throws an exception :
>
> org.datanucleus.store.appengine.query.DatastoreQuery
> $UnsupportedDatastoreFeatureException: Problem with query <SELECT FROM
> Profil p WHERE p.owner = User(21)>: Unsupported method <User> while
> parsing expression: InvokeExpression{[null].User(Literal{21})}
>
>
>
> I tried with quotes :
>
> Query query = em.query("SELECT p FROM Profil p WHERE p.user = ' " +
> userBean.getKey() + " ' ")
>
> But then, the query returns no result.
>
> Thank you for your help :)
>
> --
> 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.
>
>
--
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.