public void testGetTrackpoints() {
logger.log(BasicLevel.DEBUG, "**************testGetTrackpoints***********");
//create the competition
Competition competition = new Competition(1);
//create trackpoints
Trackpoint trackpoint1 = new Trackpoint(1);
Trackpoint trackpoint2 = new Trackpoint(2);
Trackpoint trackpoint3 = new Trackpoint(3);
Trackpoint trackpoint4 = new Trackpoint(4);
competition.addTrackpoint(trackpoint1);
competition.addTrackpoint(trackpoint2);
competition.addTrackpoint(trackpoint3);
competition.addTrackpoint(trackpoint4);
PersistenceManager pm = pmf.getPersistenceManager();
//store the graph defined above in the datastore
pm.currentTransaction().begin();
//make persistent the competition
// all the references reachable from this object will be made persistent
pm.makePersistent(competition);
pm.currentTransaction().commit();
//get the id of competition
Object idCompetition = pm.getObjectId(competition);
Competition copyCompetition = (Competition) pm.getObjectById(idCompetition, true);
//print the trackpoints
Collection collection = copyCompetition.getTrackpoints();
Iterator it = collection.iterator();
logger.log(BasicLevel.DEBUG, "Collection length=" + collection.size());
while(it.hasNext()){
Trackpoint tp = (Trackpoint) it.next();
logger.log(BasicLevel.DEBUG, "Trackpoint[id_order=" + tp.getId_order() + ",id_competition=" + tp.getId_competition() + "]");
}
//get the id of trackpoint1
Object idTrackpoint = pm.getObjectId(trackpoint1);
Trackpoint copyTrackpoint = (Trackpoint) pm.getObjectById(idTrackpoint, true);
logger.log(BasicLevel.DEBUG, "competition: " + copyTrackpoint.getCompetition().getId());
pm.close();
}