• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Entity: ManyToMany and Delete  RSS feed

Dominik Müller
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i play a little bit around with EJB and Persistence, so i get the following example which isnt't satisfying in my mind.

A Very short example, have a Many to Many Relationsship

Student << -- >> Course

annotated the two classes for biderectional behvaiour:




This Results of Course in 3 Tables. Now i add some values, 2 Students, one Course, add the Course to the Students.
Join Tables looks like:

Now i delete the referred Course "1234". The Course will deleted from Course-Table propably, but the table content of the join table remains as above listed. In my opinion: when a course is deleted, the references on this course (in the join table) should be deleted as well?? In fact i expect i "NullPointer" Exception wheren reading the studends and try to access the deletes course? (couldn't test it yet, get the deleted course from my session bean even after the delete, althought in the DB the course is deleted (may be the EM Cage? Hint on this case whould nice too )

thanks ( ) a lot
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!