templates.spring_mongo_data_access.st Maven / Gradle / Ivy
package ;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import poussecafe.discovery.DataAccessImplementation;
import poussecafe.spring.mongo.storage.MongoDataAccess;
import poussecafe.spring.mongo.storage.SpringMongoDbStorage;
import .;
import .DataAccess;
import .Id;
@DataAccessImplementation(
aggregateRoot = .class,
dataImplementation = Attributes.class,
storageName = SpringMongoDbStorage.NAME
)
public class MongoDataAccess extends MongoDataAccess\<Id, Attributes, String> implements DataAccess\<Attributes> {
@Override
public List\<Attributes> findByName(String name) {
return repository.findByName(name);
}
@Override
protected String convertId(Id key) {
return key.stringValue();
}
@Override
protected DataMongoRepository mongoRepository() {
return repository;
}
@Autowired
private DataMongoRepository repository;
}