I'm a little bit stuck with my db4o homework and I don't really know how to solve this.
The case is that I have a simple school student/credit/course database. Objects have following attributes:
Student:
- ID
- Name
Course:
- ID
- Name
- Type
Credit:
- Student
- Course
- Grade
Now when deleting a course I should also delete the credit or credits that have reference to that course. I've read the db4o manual and tried to understand this whole cascadeOnDelete thing, but the first thing I'm not sure is that do I have to set the cascadeOnDelete to true for the course or for the credit object?
The next problem is that I should be able to find all the credits with the reference to that course. How to exactly do that in db4o?
The db4o manual has some examples, but with hard coded values so it's not very helpful. Is there a way to use SQL like queries in db4o to find the credits with the "correct" references?
Also do I have to store the course proto first, then find the credits and then delete the credits first and finally the course?
I'm quite confused here and don't know how to proceed so any help is appreciated. Thanks.