• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

EJB Entity: ManyToMany and Delete

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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:

Student:
...

...

Course:


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:
"students_NAME","courses_COURSEID"
"Klaus","1234"
"Schmidt","1234"

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
Dom
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic