hankbozic (1) [Avatar] Offline
#1
Could someone please tell me where I can find the code for:
courseAndOfferingService
createCourseWithOffering


It is from page 123 of the book:
@Test
public void testPersistCourseWithOffering() {
Course course = createCourseWithOffering();
courseAndOfferingService.saveCourse(course);
Assert.assertTrue (courseAndOfferingService.countAllCourses() > 0);
Course course2 = courseAndOfferingService.findCourse(course.getId());
Assert.assertEquals( course.getId(), course2.getId());
Assert.assertEquals(1, course.getOfferings().size());
}
Hank
ken.rimple (246) [Avatar] Offline
#2
Re: createCourseWithOffering -- I cannot find this code anywhere !
> Could someone please tell me where I can find the
> code for:
> courseAndOfferingService
> createCourseWithOffering
>
Hank,

Reviewing it from a distance, I think there are two problems:

1) I should have said in the text that the method createCourseWithOffering() was a method you'd write yourself (i.e. create a course, create an offering, add the offering to the course, persist, and return it). Or I should have put it in there - it's only going to be 3-4 lines I suppose.

2) courseAndOfferingService - should have just been called courseService - MongoDB will just persist the graph.

Also,

3) We need to check in a sample app with MongoDB - I'm sorry I didn't do that. I can get that out there for the next update.