You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Combination of persistent and non-persistent objects responds empty lists for includes on Cayenne entity
Cayenne version: 4.0
AgRest version: 3.1
There is an example of aggegiated object responded.
Rest API endpoint:
@GET
public DataResponse<PlayerMatch> getMatches(@PathParam("id") int id, @Context UriInfo uriInfo) {
return Ag.select(PlayerMatch.class, config)
.stage(SelectStage.CREATE_ENTITY, (SelectContext<PlayerMatch> t) -> {
t.getEntity().setFiltered(true);
})
.terminalStage(SelectStage.APPLY_SERVER_PARAMS, (SelectContext<PlayerMatch> t) -> { // terminal stage because of ${jira_issue_number}; server params brings includes and then it might be terminated
t.getEntity().setResult(matchPlayerService.getPlayerMatches(id));
})
.uri(uriInfo).get();
}
There is custom PlayerMatch object where @AgRelationship annotated Player is Cayenne object
public class PlayerMatch {
private int matchPriority;
private Player player;
public PlayerMatch() {
}
public PlayerMatch(int matchPriority, Player player) {
this.matchPriority = matchPriority;
this.player = player;
}
@AgAttribute
public int getMatchPriority() {
return matchPriority;
}
public void setMatchPriority(int matchPriority) {
this.matchPriority = matchPriority;
}
@AgRelationship
public Player getPlayer() {
return player;
}
public void setPlayer(Player player) {
this.player = player;
}
}
And the same time Player has Cayenne relationship which is in interest to be included in response:
public abstract class _Player extends CayenneDataObject {
// ...
public static final Property<List<RosterSpot>> ROSTER_SPOTS = Property.create("rosterSpots", List.class);
When rest api endpoint requested with /rest/playermatch?include=player&include=player.rosterSpots it will response player data but [] for rosterSpots field though they are existing on database (also there is no sql query for roster spots include in log), i.e. like:
Combination of persistent and non-persistent objects responds empty lists for includes on Cayenne entity
Cayenne version: 4.0
AgRest version: 3.1
There is an example of aggegiated object responded.
Rest API endpoint:
There is custom PlayerMatch object where @AgRelationship annotated Player is Cayenne object
And the same time Player has Cayenne relationship which is in interest to be included in response:
When rest api endpoint requested with
/rest/playermatch?include=player&include=player.rosterSpots
it will response player data but[]
forrosterSpots
field though they are existing on database (also there is no sql query for roster spots include in log), i.e. like:The text was updated successfully, but these errors were encountered: