I want to use SolrJ for indexing a set of Java classes. Each class instance is determined by its id which is unique within a class. However, by using the Solr @Field annotation for making Solr documents from these classes it turns out that this annotation doesn't guarantee uniqueness of the created documents stored in the Solr index (same id values may belong to multiple classes).
I tried combining the annotation approach with the Solr UUID data type for generating unique id values into a specified field in the solr schema, but with no success.
As a result, I created a simple annotation mechanism not so different from the SolrJ one, which guarantees uniqueness across multiple classes. This is done by combining object class name and its id to get a sort of UUID which is then stored in the Solr schema.
I'm not sure if I'm not missing something, so I would like to know if the working solution described above is good enough for my case or if there are any cleaner/better alternatives.