activejdbc - Deleting an Entry in the join table of a Many-to-Many Relationship -
using example in documentation: have doctors , patients connected on join table. delete patient doctor, works fine, i.e. row in join table vanishes:
doctor.remove(patient);
is there way can retrieve remaining (n-1) patients without having reload doctor database, i.e.
doctor.getall(patient.class);
when doing without reloading doctor still deleted entry. cache purging not work. when reload doctor database deleted entry gone. way works?
this how framework works. code:
doctor.remove(patient);
removes record join table. after that, calls:
doctor.getall(patient.class);
will not returning removed patient. tested writing additional test method in https://github.com/javalite/activejdbc/blob/master/activejdbc/src/test/java/org/javalite/activejdbc/many2manyrelationshiptest.java.
here test added: https://gist.github.com/ipolevoy/821e986c5c7deb28a90d can see, line 9 gets 1 patient, because other removed on line 7.
you can turn logging on: http://javalite.io/logging see statements framework executing.
Comments
Post a Comment