I want to allow user to choose their own persistence technologies, and to do so developers must write entities that implements given interface.
By default application use spring-data with mongodb, the following are extract code from entity:
@Document(collection="event_handlers")
@CompoundIndexes({
@CompoundIndex(name = "handlers_unique_idx", def = "{'eventName': 1, 'className': 1}", unique=true, sparse=true)
})
public class HandlerImpl implements Handler {
....
}
and its related repository:
@Repository
public interface HandlerRepository extends MongoRepository<Handler, String> {
...
}
Running integration test, I’ve noticed that application write entity in an unexpected collections, named handler, as the entity interface, and not in the expected collection, name event_handlers, and besides, the composite key doesn't work because it has been associated with the right collection that remain all time empty.
That's the collection list for my db:
> show collections
event_handlers
handler
system.indexes
>
How can I use spring-data to use this kind of configuration?
Thanx