Hibernate: Cascading save for many-to-many association?

Up vote 0 down vote favorite share g+ share fb share tw.

Consider this data model. I can perform the following successfully: Save a new Course to the database Add this Course to an existing Student's set of Courses Save the existing Student to the database My STUDENT_COURSE table is successfully updated with the association between Student and Course. However, ideally, I'd like to just perform steps 2 and 3, so that the save in step 3 recognizes that the Course object does not exist and creates it first.

How do I go about performing this? When I attempt this at the moment I get this error: Could not synchronize database state with session This appears to occur when it attempts to add the Course object. Thanks hibernate link|improve this question edited 1 hour ago asked 1 hour agoDavid Joyce18818 76% accept rate.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions