README updates.
This commit is contained in:
17
README.md
17
README.md
@@ -68,20 +68,18 @@ Future plans are to support optional logging and/or exception throwing based on
|
||||
|
||||
and there is a placeholder interface called MongoRepository that will in future add more Mongo specific methods.
|
||||
|
||||
public interface MongoRepository<T, ID extends Serializable> extends
|
||||
public interface MongoRepository<T, ID extends Serializable> extends
|
||||
Repository<T, ID> {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
You can use the provided implementation class SimpleMongoRepository for basic data access. You can also extend the MongoRepository interface and supply your own finder methods that follow simple naming conventions so they can be converted into queries. For example, given a Person class with first and last name properties
|
||||
|
||||
public interface PersonRepository extends MongoRepository<Person, Long> {
|
||||
public interface PersonRepository extends MongoRepository<Person, Long> {
|
||||
|
||||
List<Person> findByLastname(String lastname);
|
||||
|
||||
|
||||
List<Person> findByFirstnameLike(String firstname);
|
||||
}
|
||||
}
|
||||
|
||||
You can have Spring automatically generate the implemention as shown below
|
||||
|
||||
@@ -103,14 +101,13 @@ You can have Spring automatically generate the implemention as shown below
|
||||
|
||||
This will register an object in the container named PersonRepository. You can use it as shown below
|
||||
|
||||
@Service
|
||||
public class MyService {
|
||||
@Service
|
||||
public class MyService {
|
||||
|
||||
@Autowired
|
||||
PersonRepository repository;
|
||||
|
||||
|
||||
@Test
|
||||
public void doWork() {
|
||||
|
||||
repository.deleteAll();
|
||||
@@ -125,7 +122,7 @@ public class MyService {
|
||||
List<Person> firstNameResults = repository.findByFirstnameLike("Oli*");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## CouchDB
|
||||
|
||||
Reference in New Issue
Block a user