Skip to content

Instantly share code, notes, and snippets.

@mdellavo
Created August 15, 2013 01:01
Show Gist options
  • Save mdellavo/6237355 to your computer and use it in GitHub Desktop.
Save mdellavo/6237355 to your computer and use it in GitHub Desktop.
Mapped classes are abstract where abstract annotated
getters that take a Query/Fetch lisener. Object will be proxied, if
an abstract getter is invoked, fetch and call listener.
abstract class Score implements Entity {
@Column(primaryKey=true)
Private int id;
private date;
private int score;
@Column(foreignKey=User.class)
private int userId;
@Relation(User.class)
public abstract void getUser(FetchListener<User> listener);
...
}
abstract class User implements Entity {
@Column(primaryKey=true)
private int id;
private String name;
@Relation(Score.class)
public abstract void getScores(QueryListener<Score> listener);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment