Arlo Duff
unread,Apr 27, 2012, 4:43:49 PM4/27/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to play-framework
Based on advice I've gotten here, I'm trying to implement a Play app
which lets the users follow other users by storing each relation in
the MySQL database. This is the code I'm using:
@Entity
public class followerRelation extends Model {
public User follower;
public User followee;
public followerRelation(Long followerId, Long followeeId) {
this.follower = User.findById(followerId);
this.followee = User.findById(followeeId);
}
public followerRelation(User follower, User followee) {
this.follower = follower;
this.followee = followee;
}
}
When a user chooses to follow another user, the code creates a new
followerRelation object and invokes its save() function.
But for some reason, trying to search the MySQL database is giving me
a "could not serialize" error. For example, code like this triggers
the error:
followerRelation friendship = followerRelation.find("select f from
followerRelation f where f.follower = ?1 and f.followee = ?2",
follower, followee).first();
where follower and followee are both User objects.
This is all that's going on. I've cleared the MySQL database and
started Play fresh, and it's giving me this error, without ever having
added any data to the followerRelation table. Does anyone know how to
handle this? I have no idea what to do when Play starts giving me
Hibernate errors.