DATACMNS-20 - Adapted refactoring of Repository.findById(…) to findOne(…).

This commit is contained in:
Oliver Gierke
2011-03-11 18:19:45 +01:00
parent 68635687d1
commit f585beffc8
3 changed files with 15 additions and 19 deletions

View File

@@ -1,16 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -90,7 +90,7 @@ public class SimpleMongoRepository<T, ID extends Serializable> implements Paging
*
* @see org.springframework.data.repository.Repository#findById(java.io.Serializable )
*/
public T findById(ID id) {
public T findOne(ID id) {
return template.findOne(entityInformation.getCollectionName(), getIdQuery(id), entityInformation.getJavaType());
}
@@ -113,7 +113,7 @@ public class SimpleMongoRepository<T, ID extends Serializable> implements Paging
*/
public boolean exists(ID id) {
return findById(id) != null;
return findOne(id) != null;
}
/*

View File

@@ -57,7 +57,7 @@ public abstract class AbstractPersonRepositoryIntegrationTests {
@Test
public void findsPersonById() throws Exception {
assertThat(repository.findById(dave.getId()), is(dave));
assertThat(repository.findOne(dave.getId()), is(dave));
}
@Test