hi all,

i have a JDO query that i would like to port to JPA.

Friend Entity
@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Friend {

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private Key key;

  @Persistent
  private String lastName;

  @Persistent
  public int crud;

  @Persistent
  private String firstName;

  @Persistent(defaultFetchGroup = "true")
  private Collection<Key> friends;


//JDO
     javax.jdo.Query query = pm.newQuery(Friend.class);
     Key myKey = user2.getKey();
     query.declareParameters("com.google.appengine.api.datastore.Key
myKey");
     query.setFilter("friends == myKey");
     query.setOrdering("crud ASC, lastName ASC, firstName ASC");
     List<Friend> friendList = (List<Friend>) query.execute(myKey);


The problem i am having is with the query.setFilter("friends ==
myKey" ) portion.

   //JPA
      javax.persistence.Query query = em.createQuery("select from
Friend where friends=:key");
      query.setParameter("key", user2.getKey());
      List<Friend> friendList = (List<Friend>) query.getResultList();

however the resultlist returns 0.

any help is appreciated

-lp

--

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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=.


Reply via email to