When having the following entities:
{code} @Entity public class Court { @EmbeddedId private CourtId id;
private String name;
@OneToMany(mappedBy = "playedOn") private Set<Game> games = new HashSet<Game>(); ... } {code}
{code} @Entity public class Game { @EmbeddedId private GameId id;
private String name;
@ManyToOne private Court playedOn; ... } {code} Then we create the following persistent format atm. in MongoDB (need to check CouchDB as well):
{code} > db.Game.find() { "_id" : { "category" : "primary", "sequenceNo" : "456" }, "name" : "Bruce - Dwain", "playedOn_id" : { "countryCode" : "DE", "sequenceNo" : "123" } } > db.Court.find() { "_id" : { "countryCode" : "DE", "sequenceNo" : "123" }, "games" : [ { "id.sequenceNo" : "456", "id.category" : "primary" } ], "name" : "Center Court" } {code}
Rather it should be:
{code} > db.Game.find() { "_id" : { "category" : "primary", "sequenceNo" : "456" }, "name" : "Bruce - Dwain", "playedOn" : { "countryCode" : "DE", "sequenceNo" : "123" } } > db.Court.find() { "_id" : { "countryCode" : "DE", "sequenceNo" : "123" }, "games" : [ { "sequenceNo" : "456", "category" : "primary" } ], "name" : "Center Court" } {code}
|