New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DATAMONGO-440 - implemented cascade operations on @DBRef fields #3
DATAMONGO-440 - implemented cascade operations on @DBRef fields #3
Conversation
…e key (DATAMONGO-299)
…nstead of autowired fields - test classes renamed to fit project convention
@@ -850,16 +845,18 @@ public WriteResult doInCollection(DBCollection collection) throws MongoException | |||
}); | |||
} | |||
|
|||
public void remove(Object object) { | |||
public <T> void remove(T object) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the benefit of adding generics here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to emit generic AfterDeleteEvent. CascadingMongoEventListener catches events for all types of objects so generics are not used in this case but if someone would want to create his own listener for particular type then generics are needed.
Looks quite cool again. Here are some idea's looking at the code:
|
Thanks for feedback. I will handle your ideas/questions in couple of days (when i am back from Geecon conference) |
Hey there. I'm a long time Doctrine Mongo ODM user and have been using Spring's Mongo support for all of 24 hours now and thought I'd share two areas of concern related to this topic: First, this PR doesn't appear to support cascading operations on Collections. Thankfully it shouldn't be hard to add. I'd argue that you have to either support cascades across the board or not at all. If you try to explain to someone that cascades only work on 1:1 and not 1:M they'll just look at you cross-eyed. Secondly, and more importantly, there's a serious limitation in Like I said, I've been using this lib for less than a day so I apologize if I'm just missing something. |
+1 on the collections support. Regarding the problem of accessing a different database I agree in terms of the symptom but not on the solution side of things. First one doesn't have to extend |
Collections support added. I will develop missing stuff hopefully today evening and tomorrow. |
what is the status of this issue ? |
+1 |
3 similar comments
+1 |
+1 |
+1 |
I too am searching for the latest status on this issue. |
9cbd59a
to
d2ecd65
Compare
+1 |
+1 on this as well. Looks like there are merge conflicts? |
+1 |
2 similar comments
+1 |
+1 |
+1024 |
👍 |
2 similar comments
+1 |
+1 |
+1 |
2 similar comments
+1 |
+1 |
Apologies to all who requested this feature, but I am closing it without merging for two reasons:
If you are not convinced and you would like to pick up my branch, rebase against master and fix everything what's broken - go for it, but I suggest to discuss it first with Spring Data team. |
Pull request contains implementation of cascading operations: save and delete on fields annotated with @DBREF. Implementation details:
This implementation is inspired by my research about cascading in Spring Data MongoDB described on blog: http://maciejwalkowiak.pl/blog/2012/04/30/spring-data-mongodb-cascade-save-on-dbref-objects/ where i found that it can be done now by implementing custom event listener but without internal framework changes its a little bit hacky (used reflection instead of Spring Data persistent-entity-like classes, additional annotation, impossible to implement cascading on delete).
If you like this idea and you have suggestions how this implementation can be improved i would be happy to make appropriate changes