hi there
i am porting a python GAE to java but have come unstuck with self
reference type.
my existing data model uses the SelfReferenceProperty and it allow me
to do a very powerful query in a simple manner.
Python model
----------------------
class PositionUser(db.Model):
user = db.UserProperty()
latitude = db.FloatProperty()
longitude = db.FloatProperty()
name = db.StringProperty()
friend = db.SelfReferenceProperty( collection_name='friend_user' )
Query
-------
userRef = Model.PositionUser.gql("where user=:1", user).get()
positions = user.friend_user.filter('latitude>',minLat).filter
('latitude <', maxLat)
However when porting to java, i am unable to achieve the 'collection
filter' that was available in python.
currently i am using the familiar JPA.
i have implemented the sefReference property as a @OneToMany.
my model is below
JPA
----------
@Entity
public class PositionUser {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Key key;
User user;
String latitude;
float longitude;
@OneToMany
Collection<PositionUser> friends ;
But i am unable to achieve the same query result.
PositionUser positionUser = em.find(PositionUser.class, user1.getKey
());
but now how to filter positionUser.friends based on their latitude?
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 [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=.