@ODM/GeneratedValue annotation added #539

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants

mrjazz commented Mar 27, 2013

Sometimes useful control ID of documents instead of using auto
generation. GeneretadValue annotation with value NONE allow it

@mrjazz mrjazz @GeneratedValue annotation support
Sometimes useful control ID of documents instead of using auto
generation. GeneretadValue annotation with value NONE allow it
c9e7c1a
Owner

jmikola commented Mar 28, 2013

I don't understand the explanation you've written above. What is the feature you're implementing?

A few concerns:

  • The incrementing generator is currently limited to managing a single incrementing value per collection (the collection is used as the _id of each document in IncrementGenerator). AlnumGenerator also uses this.
  • Building upon the above, logic for generating values only exists for identifier fields. This PR appears to set the mapping information, but I don't see any place that it would actually be respected by ODM.
  • This is adding an annotation but omitting support for other metadata loaders (e.g. YAML, XML).

mrjazz commented Mar 29, 2013

What I need is ability set my _id key and with GeneratedValue annotation I able turn off autogeneration of id and set it from my side.
Yes, you are right, I didn't think about yaml and xml support.

Owner

jmikola commented Apr 1, 2013

If you need to set a custom _id value, why not use the none strategy? Alternatively, you can create a custom generator class and utilize that.

mrjazz commented Apr 1, 2013

Maybe I missed something but it's exactly what I did with my patch. How can I change strategy without @generatedvalue annotation?

Owner

jmikola commented Apr 1, 2013

@Id strategies are discussed here.

mrjazz commented Apr 1, 2013

Yes, missed it. Exactly what I need. Thanks. You can ignore my pull request.

jmikola closed this Apr 1, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment