-
Notifications
You must be signed in to change notification settings - Fork 455
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
Add @Polymorphic [moved] #22
Comments
We just ran into this limitation which is having an impact on what we can do with Morphia. Also referenced on stack overflow: http://stackoverflow.com/questions/21921442/getting-multiple-types-from-same-morphia-query Any interest in this now? It looks like this original ticket is from 2010. :( |
Interest, yes. The timing is uncertain. Probably post-1.0 at this point. The C# driver has an interesting solution i'll probably steal but it'll take some refactoring first. |
This is major for me as well. I'm facing a lot of issues and having to resort to direct driver use to work around these issues as Morphia does not play nicely with polymorphic structures. Say, if one has class A and B and C that inherit from them it seems natural that A could be annotated with @polymorphic and all instances of A, B and C would then go to the A's collection. For each record, I like the idea of storing an array of class names going up in the type hierarchy for stored objects instead of the fully qualified name for the concrete implementation classes stored. This way one could query for instances of A, B, C or a combination of them and have them properly filtered and casted. This is a major limitation and a bit discouraging to see it open from 2010... it's been 5 year after all :( |
Just as a side not if anyone is interested in a work around, as for the example above instead of querying for ...I am instead querying for:
which works well but is a bit ugly. Also I don't know if we add an index to the |
+1 to issue |
3 similar comments
+1 to issue |
+1 to issue |
+1 to issue |
+1 |
1 similar comment
+1 |
+1 or is this closed i.e. implemented already? |
+1 |
1 similar comment
+1 |
any progress about this one? |
I know this ticket is pretty old but I just wanted to provide an alternative. |
Any opinions or progress about this issue? Otherwise we can start the 5 year celebration - if it didn't take place already ;-) Thanks @webermich for your effort, but changing the mapping to a different mechanism is not possible for me at the moment. |
I actually have this done in my fork that I'm working on. I've replaced the mapping code with the driver's POJO stuff i helped write. It's getting pretty close to done. |
@evanchooly any update on this? |
+1 🥇 |
working now in 2.0 though the |
FongoDBCollection.idsIn(DBObject) throws ClassCastException Check if it's a List or Object array before casting
Fix for Issue MorphiaOrg#22
Simulation of mongodb text search impl
@evanchooly Can you please explain how this should work in Morphia 2.4.2? I tried:
If I save an instance of |
You have to enable polymorphic queries. But please open a discussion topic rather than comment on 10 year closed issues so that folks aren't notified unnecessarily. |
This is Issue 22 moved from a Google Code project.
Added by 2010-03-31T16:32:45.000Z by scotthernandez.
Please review that bug for more context and additional comments, but update this bug.
Original labels: Type-Enhancement, Priority-Medium, Milestone-Release1.1
Original description
The text was updated successfully, but these errors were encountered: